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 are the methods in object?
What is method in research paper?
What’s the difference between constructors and other methods?
How are multiple inheritances done in Java?
Can you tell me range of byte?
Can a class have an interface?
How to sort double array in java?
what is difference between equals and ==?
How many static init can you have?
Is a method a procedure?
Why do we need array in java?
Why do we declare a class static?
What is gc()?
Why is stringbuffer thread safe?
What does @override mean?