JAVA基础问题,请各位不吝赐教;在线等,又答案立即结贴
要求打印26个英文字母,要求每个字母之间间隔一个制表符
char c= 'a '
for (int i=1;i <=26;i++)
System.out.print(这里怎么填??);
------解决方案--------------------System.out.print(((int)c + i) + "\t ");
------解决方案--------------------public class Output {
public static void main(String[] args){
char c= 'a ';
for (int i=1;i <=26;i++){
System.out.print((char)(c+i)+ "\n ");
}
System.out.print( "ok ");
}
}
------解决方案--------------------public class Output
{
public static void main(String[] args)
{
char c= 'a ';
for (int i=0;i <=25;i++)
{
System.out.print((char)(c+i)+ "\n ");
}
System.out.print( "ok ");
}
}
------解决方案--------------------class Noname2
{
public static void main(String[] args)
{
char c1= 'a ';
for (int i=0;i <26;i++)
{
System.out.print((char)(c1+i)+ " "+ '\t ');
}
}
}