用循环打印26个字母。

public class Test03 {

   public static void main(String[] args) {

        //定义了一个char型的数组a

       char[] a;

       //实例对象数组,长度为25

       a = new char[26];

       for (int i = 0; i < 26; i++){

       //通过把A的ascii码和循环变量进行相加来转换各个字码的ascii码

          a[i] = (char)('a' + i);

          System.out.print(a[i]);

           if(a[i]=='z'){

          System.out.println("结束");

      }

    }

  }

}  

运行结果。

原文地址:https://www.cnblogs.com/s1297-lgy/p/5636435.html