728x90
기본자료형 byte boolean char short int long float double |
WrapperClass Byte Boolean Character Short Integer Long Float Double |
자료형을 효율적으로 관리함과 동시에 완벽한 은닉화를 추구하기 위해 만들어진 자료형 대체 클래스
class WrapperClassTest
{
public static void main(String args[])
{
boolean b = true;
Boolean B = new Boolean(b);
int i = 30;
Integer I = new Integer(i);
float f = 23.5f;
Float F = new Float(f);
System.out.println("Wrapper 클래스 값 :" +B.toString());
System.out.println("Wrapper 클래스 값 :" +I.toString());
System.out.println("Wrapper 클래스 값 :" +F.toString());
int v = 100;
//String str = (String)v; //에러
//String str = v+"";
String str = Integer.toString(v);
System.out.println(str);
}
}