package com.chunzhi.Test04Poker;
import java.util.ArrayList;
import java.util.List;
public class ListDemo {
public static void main(String[] args) {
//示例1:
int[] arr = {1,2,3,4,5};
for (int i : arr){
System.out.println(i);
}
System.out.println("--------");
//示例2:
String[] strArray = {"hello","world","java"};
for (String str : strArray){
System.out.println(str);
}
System.out.println("--------");
//示例3:
List<String> list = new ArrayList<String>();
list.add("我爱学习");
list.add("我爱Java");
list.add("坚持");
for (String s : list){
System.out.println(s);
}
}
}
运行结果:
原文链接:https://www.cnblogs.com/pxy-1999/p/12658069.html
此次拷贝仅供本人学习方便所用