-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRawTest1.java
More file actions
27 lines (24 loc) · 1016 Bytes
/
Copy pathRawTest1.java
File metadata and controls
27 lines (24 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*------------------------------------------------------------------------------
* Oracle Certified Professional Java SE 8 Programmer Exam 1Z0-809
* A Comprehensive OCPJP 8 Certification Guide
* by SG Ganesh, Hari Kiran and Tushar Sharma
------------------------------------------------------------------------------*/
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
class RawTest1 {
public static void main(String []args) {
List list = new LinkedList();
list.add("First");
list.add("Second");
List<String> strList = list; //#1
for(Iterator<String> itemItr = strList.iterator(); itemItr.hasNext();)
System.out.println("Item: " + itemItr.next());
List<String> strList2 = new LinkedList<>();
strList2.add("First");
strList2.add("Second");
List list2 = strList2; //#2
for(Iterator<String> itemItr = list2.iterator(); itemItr.hasNext();)
System.out.println("Item: " + itemItr.next());
}
}