end of day, done till 13
This commit is contained in:
15
Iterator10.java
Normal file
15
Iterator10.java
Normal file
@@ -0,0 +1,15 @@
|
||||
// 10. write a javac code to implement iterator to access collection element
|
||||
import java.util.*;
|
||||
class Iterator10{
|
||||
public static void main(String args[]){
|
||||
ArrayList<String> nameList = new ArrayList<String>();
|
||||
nameList.add("Aditya");
|
||||
nameList.add("Vijay");
|
||||
nameList.add("Ravi");
|
||||
nameList.add("Ajay");
|
||||
Iterator itr = nameList.iterator();
|
||||
while(itr.hasNext()){
|
||||
System.out.println(itr.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user