35. Java Iterator - Java | OOPs | Hackerrank

preview_player
Показать описание
Java Iterator class can help you to iterate through every element in a collection.

public class Example{

public static void main(String []args){
ArrayList mylist = new ArrayList();
}
}

In this problem you need to complete a method func. The method takes an ArrayList as input. In that ArrayList there is one or more integer numbers, then there is a special string "###", after that there are one or more other strings.
Рекомендации по теме
Комментарии
Автор

Why does it print the rest of the list elements, even though the break happens at the "###" part?

vinci_irl
Автор

If it breaks the loop after ### then how it will print Hello and Java please

haidarmohammad
Автор

Can you explain why we use instead of System.out.println(element);
What is its significance

saggarwal
Автор

Could you please explain this statement of the code :
it would be a great help.

tejaswibhargava