以下实例演示了如何通过循环输出数组:
public class Welcome { public static void main(String[] args){ String[] dida100s = new String[3]; dida100s[0] = "滴答编程"; dida100s[1] = "菜鸟工具"; dida100s[2] = "菜鸟笔记"; for (int i = 0; i < dida100s.length; i++){ System.out.println(dida100s[i]); } } }
以上代码运行输出结果为:
菜鸟教程 菜鸟工具 菜鸟笔记