public class a1 {
public static void main(String[] args) {
System.out.print("方法一的结果为 ");
char[] arr1 = new char[26];
char a = 'A';
for (int i = 0;i < 26;i++) {
arr1[i] = a;
a++;
System.out.print(arr1[i] + "\t");
}
System.out.println();
System.out.print("方法二的结果为 ");
char[] arr2 = new char[26];
int count = 0;
for (char i = 'A'; i <= 'Z'; i++) {
arr2[count] = i;
System.out.print(arr2[count] + "\t");
count++;
}
System.out.println();
System.out.print("方法三的结果为 ");
char[] arr3 = new char[26];
for (int i = 0;i < 26;i++) {
arr3[i] = (char)('A' + i);
System.out.print(arr3[i] + "\t");
}
}
}
07-30
84
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-02
546
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)