DBox<String, Integer> box2 = new DBox<>();
box2.set("Orange", 33);
DDBox<DBox<String, Integer>, DBox<String, Integer>> ddbox = new DDBox<>();
ddbox.set(box1, box2);
System.out.println(ddbox);
}
}
Apple & 25
Orange & 33
Box box2 = new Box<>();
box2.set(55);
System.out.println(box1.get() + " & " + box2.get());
swapBox(box1, box2);
System.out.println(box1.get() + " & " + box2.get());
}
99 & 55
55 & 99

ArrayList, LinkedList 장점과 단점을 설명하시오.
ArrayList의 장점
ArrayList의 단점
저장 공간을 늘리는 과정에서 시간이 비교적 많이 소모,
인스턴스의 삭제 과정에서 많은 연산이 필요할 수 있다. 따라서 느릴 수 있다.
LinkedList의 장점
저장 공간을 늘리는 과정이 간단하다.
저장된 인스턴스의 삭제 과정이 단순하다.
LinkedList의 단점
저장된 인스턴스의 참조 과정이 배열에 비해 복잡하다. 따라서 느릴 수 있다.