JAVA_EnhancedFor_and_Set

 1 import java.util.*;
 2
 3 public class EnhancedFor {
 4     public static void main(String[] args) {
 5         int[] arr = {1, 2, 3, 4, 5};
 6         for(int i : arr) {
 7             System.out.println(i);
 8         }
 9
10         Collection c = new ArrayList();
11         c.add(new String("aaa"));
12         c.add(new String("bbb"));
13         c.add(new String("ccc"));
14         for(Object o : c) {
15             System.out.println(o);
16         }
17     }
18 }

时间: 2024-10-12 02:44:36

JAVA_EnhancedFor_and_Set的相关文章