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 a "pure virtual" member function?
What is the method in java?
What is static block?
Why is boolean important?
What is a map? What are the implementations of map?
How many days will it take to learn java?
What is a string what operation can be performed out with the help of a string?
Why a dead thread occurs?
Explain the difference between an object-oriented programming language and object-based programming language?
Why strings in java are called as immutable?
What is the use of volatile in java?
Is finalize() similar to a destructor?
what is a thread pool in java and why is it used?
What is the purpose of final keyword and when to use it?
What is string in java?