编写一个Java应用程序,输出全部的希腊字母。

重谢!最好赶快一些,提供答案会加30悬赏的
2024-12-17 15:59:37
推荐回答(5个)
回答1:

代码如下:

package 输出全部希腊字母;

  public class GreekAlphabet {
  public static void main(String args[]) {
  int startPosition = 0, endPosition = 0;
  char cSrart = 'α', cEnd = 'ω';
  startPosition = (int) cSrart;
  endPosition = (int) cEnd;
  System.out.println("希腊字母表:");
  System.out.println("小写:");
  for (int i = startPosition; i <= endPosition; i++) {
  char c = '\0';
  c = (char) i;
  System.out.print(" " + c);
  if ((i - startPosition + 1) % 10 == 0) {
  System.out.println("");
  }
  }

  System.out.println();
  cSrart = 'Α';
  cEnd = 'Ω';
  startPosition = (int) cSrart;
  endPosition = (int) cEnd;
  System.out.println("大写:");
  for (int i = startPosition; i <= endPosition; i++) {
  char c = '\0';
  c = (char) i;
  System.out.print(" " + c);
  if ((i - startPosition + 1) % 10 == 0) {
  System.out.println("");
  }
  }
  }
  }

结果:

希腊字母表:
小写:
 α β γ δ ε ζ η θ ι κ
 λ μ ν ξ ο π ρ ? σ τ
 υ φ χ ψ ω
大写:
 Α Β Γ Δ Ε Ζ Η Θ Ι Κ
 Λ Μ Ν Ξ Ο Π Ρ ? Σ Τ
 Υ Φ Χ Ψ Ω

回答2:

public static void printGreek()
{
int firstLetter, lastLetter;
char firstG = 'α', lastG = 'ω'; //获取首字母与末字母的值

firstLetter = (int)firstG;
lastLetter = (int)lastG;

System.out.println("希腊字母表: ");
for(int i = firstLetter; i <= lastLetter; ++i)
{
char greekLetter;

greekLetter = (char)i;

System.out.print(" "+greekLetter);
}

System.out.println();
}
参考地址:http://blog.csdn.net/qdliuzhen/article/details/8057705

回答3:

public class GreekAlphabet {
public static void main(String args[]) {
int startPosition = 0, endPosition = 0;
char cSrart = 'α', cEnd = 'ω';
startPosition = (int) cSrart;
endPosition = (int) cEnd;
System.out.println("希腊字母表:");
System.out.println("小写:");
for (int i = startPosition; i <= endPosition; i++) {
char c = '\0';
c = (char) i;
System.out.print(" " + c);
if ((i - startPosition + 1) % 10 == 0) {
System.out.println("");
}
}

System.out.println();
cSrart = 'Α';
cEnd = 'Ω';
startPosition = (int) cSrart;
endPosition = (int) cEnd;
System.out.println("大写:");
for (int i = startPosition; i <= endPosition; i++) {
char c = '\0';
c = (char) i;
System.out.print(" " + c);
if ((i - startPosition + 1) % 10 == 0) {
System.out.println("");
}
}
}
}

回答4:

public class XLWords

{public static void main(String args[])
{for(int i=913;i<930;i++)
{
System.out.print((char)i+"");
}
for(int j=931;j<938;j++)
{
System.out.print((char)j+"");
}
for(int k=945;k<962;k++)
{
System.out.print((char)k+"");
}
for(int t=963;t<969;t++)
{
System.out.print((char)t+"");
}
}
}

回答5:

public class GreekAlphabet {
public static void main(String args[]) {
int startPosition = 0, endPosition = 0;
char cSrart = 'α', cEnd = 'ω';
startPosition = (int) cSrart;
endPosition = (int) cEnd;
System.out.println("希腊字母表:");
System.out.println("小写:");
for (int i = startPosition; i <= endPosition; i++) {
char c = '\0';
c = (char) i;
System.out.print(" " + c);
if ((i - startPosition + 1) % 10 == 0) {
System.out.println("");
}
}

System.out.println();
cSrart = 'Α';
cEnd = 'Ω';
startPosition = (int) cSrart;
endPosition = (int) cEnd;
System.out.println("大写:");
for (int i = startPosition; i <= endPosition; i++) {
char c = '\0';
c = (char) i;
System.out.print(" " + c);
if ((i - startPosition + 1) % 10 == 0) {
System.out.println("");
}
}
}
}