Generic (1) 썸네일형 리스트형 generic 예제 MainWrapper package ex01_generic; public class MainWrapper { public static void main(String[] args) { //String을 저장하는 box1 Boxbox1=new Box(); box1.setItem("Hello world"); System.out.println(box1.getItem()); //Integer 를 저장하는 box2 Boxbox2=new Box(); box2.setItem(3); System.out.println(box2.getItem()); //Person을 저장하는 box3 Boxbox3=new Box(); box3.setItem(new Person("김응가")); System.out.println(box3.ge.. 이전 1 다음