네트워크 연결 끊김
Description
데이터를 중간에 추가하려면 데이터를 추가하려는 위치와 추가하려는 데이터가 필요합니다.
데이터를 추가하려는 위치인 index(int 타입)과 추가하려는 데이터 element(Object 타입)를 인자로 받는 add 함수를 완성해보세요. add 함수는 public함수이며, boolean을 리턴합니다.
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
class ArrayList {
private int size = 0;
private Object[] elementData = new Object[50];
public boolean addLast(Object element)
{
elementData[size++] = element;
return true;
}
// int 타입 index와 Object 타입 element를 인자로 받는 public 함수 add를 완성하세요.
// add 함수는 boolean을 리턴합니다.
public
{
return true;
}
}
1
2
3
4
5
6
7
8
9
10
11
public class MainRunner
{
public static void main(String[] args)
{
ArrayList arraylist = new ArrayList();
arraylist.addLast(3);
arraylist.addLast(5);
arraylist.add(1, 4);
return ;
}
}
Result
Stop
Result of [Run] or [Submit] will be displayed here