program 10
This commit is contained in:
BIN
Screenshots/program10.png
Normal file
BIN
Screenshots/program10.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
15
TestJavaCollection1.java
Normal file
15
TestJavaCollection1.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// 10 write a java code to implement Iterator to access collection elements
|
||||||
|
import java.util.*;
|
||||||
|
class TestJavaCollection1{
|
||||||
|
public static void main(String[] args){
|
||||||
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
|
list.add("Ravi");
|
||||||
|
list.add("Vijay");
|
||||||
|
list.add("Ravi");
|
||||||
|
list.add("Ajay");
|
||||||
|
Iterator itr = list.iterator();
|
||||||
|
while(itr.hasNext()){
|
||||||
|
System.out.println(itr.next());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user