Network disconnection
Description
Iterator 객체를 만들었으니, while문으로 myarrlist의 모든 원소를 출력해봅시다. 다음 가이드를 보고 코드의 빈 부분을 완성하세요.
- 이터레이터의
hasNext()
메소드를 쓰면 더 순회할 엘레먼트가 있는지 알 수 있습니다. - 이터레이터의
it.next()
메소드를 쓰면 다음 엘레먼트를 갖고 올 수 있습니다.
Fill type challenge HOWTO
- In the Fill type challenge, you have to fill the blank with appropriate code
- The given code except the blank cannot be edited.
- An error message will be shown in the Result area when you leave the blank empty.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.ArrayList;
import java.util.Iterator;
public class MainRunner
{
public static void main(String[] args)
{
ArrayList<String> my_arr_list = new ArrayList<String>();
my_arr_list.add("hello");
my_arr_list.add("java");
my_arr_list.add("world!");
Iterator<String> it = my_arr_list.iterator();
// while문으로 my_arr_list의 모든 원소를 출력해봅시다.
while( )
{
System.out.println( );
}
}
}
Result
Stop
Result of [Run] or [Submit] will be displayed here