07-使用循环进行遍历数组(运算符)

/**
 * 遍历数组的两种方式
 * 
 * @author supermanxkq
 * 
 */
public class Test5 {
	public static void main(String[] args) {
		String[] name = new String[] { "张三", "李四", "王五", "赵六" };

		for (int i = 0; i < name.length; i++) {
			System.out.println(name[i]);
		}
		
		
		System.out.println("使用while循环。。。。。。。。。。");
		int index = 0;
		while (index < name.length) {
			System.out.println(name[index++]);
		}

	}
}

后者效率要比前者的效率高!

原文地址:https://www.cnblogs.com/snake-hand/p/3146722.html