제너릭 클래스 (1) 썸네일형 리스트형 5-1) 제네릭 클래스의 raw type은 사용하지 마라 제네릭 클래스 public class Printer { private T source; public Printer(T source) { this.source = source; } public void setSource(T source) { this.source = source; } public void print() { System.out.println(source); } } // 제네릭 클래스 덕분에 String, Integer 타입의 클래스를 따로 만들지 않고 사용할 수 있다. Printer strPrinter = new Printer("hello"); strPrinter.print(); Printer intPrinter = new Printer(100); intPrinter.print(); 제네릭 .. 이전 1 다음