以下是显示英文字母A到Z的示例。
public class DisplayingAtoZ {
public static void main(String args[]){
char ch;
System.out.println("List of alphabets are ::");
for(ch = 'A'; ch <= 'Z'; ch++ ){
System.out.print(ch+" ");
}
}
}输出结果
List of alphabets are :: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z