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
Can java object be locked down for exclusive use by a given thread?
How can constructor chaining be done by using the super keyword?
What happens if we override only equals?
What are the steps that are followed when two computers connect through tcp?
Can we have static methods in an interface?
What are the types of relation?
How do I print a “?
What are the two types of java?
What is the use of flag?
what are different ways in which a thread can enter the waiting state? : Java thread
What is java volatile?
Why we used break and continue statement in java?
Explain about data types?
What is java console application?
What is the use of System class?