Java 数组输出
通过循环输出数组
public class Welcome { public static void main(String[] args){ String[] greeting = new String[3]; greeting[0] = "Python"; greeting[1] = "PHP"; greeting[2] = "Perl"; for (int i = 0; i < greeting.length; i++){ System.out.println(greeting[i]); } } }
编译运行以上 Java 代码,输出结果如下
Python PHP Perl