forked from teddyzhang1976/ThinkInJava4thSampleCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListOfInt.java
More file actions
17 lines (16 loc) · 423 Bytes
/
ListOfInt.java
File metadata and controls
17 lines (16 loc) · 423 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//: generics/ListOfInt.java
package generics; /* Added by Eclipse.py */
// Autoboxing compensates for the inability to use
// primitives in generics.
import java.util.*;
public class ListOfInt {
public static void main(String[] args) {
List<Integer> li = new ArrayList<Integer>();
for(int i = 0; i < 5; i++)
li.add(i);
for(int i : li)
System.out.print(i + " ");
}
} /* Output:
0 1 2 3 4
*///:~