Can we iterate through collection using for loop?
Answer Posted / haneef
Yes, We can
Set set=new HashSet();
set.add("one");
set.add("two");
for(Iterator it=set.iterator();it.hasNext();)
{
System.out.println(it.next());
}
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is one third plus one third as a fraction?
What is the difference between jfc & wfc?
Why super is first line in java?
What is file in java?
Explain about automatic type conversion in java?
How many types of parsers are there?
What do you understand by synchronization?
What is the purpose of static methods and variables?
Who found java?
What is the main use of generics in java?
Difference between final and effectively final ?
Can you access the private method from outside the class?
Can we declare a class as abstract without having any abstract method?
Can a class have 2 constructors?
I want to persist data of objects for later use. What’s the best approach to do so?