영어로 읽는 코딩

11_[자바] wrapper와 autoboxing

The “wrapper” classes for the primitive data types allow you to make a non-primitive object on the heap to represent that primitive type. For example:

char c = ‘x’;

Character ch = new Character(c);

Or you could also use:

Character ch = new Character(‘x’);

Java SE5 autoboxing will automatically convert from a primitive to a wrapper type:

Character ch = ‘x’;

and back:

char c = ch;

 

[Thinking in Java 44]

댓글

댓글 본문
버전 관리
Yoo Moon Il
현재 버전
선택 버전
graphittie 자세히 보기