#SimpleArrayList: remove 구현 ## CODE <a class='btn btn-default' href='/codes/14302'>Link</a> ``` public class SimpleArrayListTest { public static void main(String[] args) { SimpleArrayList list = new SimpleArrayList(); System.out.println(list); list.remove(4); //뼈대 코드가 잘못됐습니다.(뼈대코드 - 6, 3으로 나와있음) list.remove(2); System.out.println(list); } } class SimpleArrayList { int[] elements; int size; public SimpleArrayList() { this.elements = new int[10]; this.size = 8; for (int i = 0; i < size; i++) { elements[i] = 100 - 4 * i; } } public void remove(int index) { /* 해당 메소드를 구현하시오. */ for(int i=index; i<size; i++){ elements[i]=elements[i+1]; } size--; } public String toString() { StringBuffer sbuf = new StringBuffer("list = "); for (int i = 0; i < size; i++) { sbuf.append(elements[i] + " "); } return sbuf.toString(); } } ``` ## INPUT ``` ``` ## OUPUT ``` list = 100 96 92 88 84 80 76 72 list = 100 96 88 80 76 72 ```
# 피드백 감사합니다! 생유, 아리가또, 쒜쒜!