标签:++ demo rgs public 循环 for循环 增强 对象 数组
public class demo3 { public static void main(String[] args) { // 增强for循环 <=> 数组或者集合对象的语法糖 int[] arr = {1,2,3,4,5,6}; // 最笨的方法 for(int i = 0; i < arr.length; i++){ System.out.println("这是" + i); } // 语法糖 for(int x:arr){ System.out.println("这是" + x); } } }
标签:++ demo rgs public 循环 for循环 增强 对象 数组
原文地址:https://www.cnblogs.com/wchjdnh/p/14398066.html