래퍼 클래스 Wrapper Class
ㄴ 기본 자료형을 클래스로 만들어 놓은 것
package test;
public class Ex00 {
public static void main(String[] args) {
Integer num = new Integer(10); // heap 영역에 Integer객체 생성
System.out.println(num); // 10
Integer num1 = 10; // 자동 박싱
int num2 = 10; // 자동 언박싱
String data1 = "10";
int i = Integer.parseInt(data1);
System.out.println("data1의 int값 변환 : " + i); // 10
System.out.println(num.parseInt(data1)); // 10
}
}
'Java > ☞' 카테고리의 다른 글
[28] 객체 : Calendar (0) | 2020.09.18 |
---|---|
[27] 객체 : Date (0) | 2020.09.18 |
[25] 은닉성 - get set 메서드 (0) | 2020.09.18 |
[24] 메서드와 생성자 (0) | 2020.09.17 |
[23] member 전역변수와 Static & Instance (0) | 2020.09.17 |
댓글