java예제
-
java :: 오토박싱(autobaxing) 예제IT/Java & JSP & FW 2012. 3. 14. 17:38
예제 1 (AutoboxingEx1.java) //랩퍼클래스 class AutoboxingEx1 { Integer var; public void setInt(int i){ var = new Integer(i); } public Integer getInt(){ return var; } public static void main(String[] args){ AutoboxingEx1 a1 = new AutoboxingEx1(); a1.setInt(10000); Integer temp = a1.getInt(); int res = temp.intValue(); System.out.println("res :"+res); } } 예제 2 (AutoboxingEx2.java) class AutoboxingEx2 { I..