基本数据类型
|
封装类
|
boolean
|
Boolean
|
byte
|
Byte
|
short
|
Short
|
int
|
Integer
|
long
|
Long
|
char
|
Character
|
float
|
Float
|
double
|
Double
|
public
class
IntegerTest
... {
public static void main(String[] args)
...{
int i=5;
Integer in=new Integer(i);//基本类型转化为封装类型
System.out.println(in);
int j=in.intValue();
System.out.println(in); //封装类型转化为基本类型
String str=in.toString();
System.out.println(str);//封装类型转化为String
String str1="123";
System.out.println(Integer.valueOf(str1));//String转化为封装类型
int ii=6;
Integer inn=new Integer(ii);
String str2=inn.toString();
System.out.println(str2);
/** *//**
String str3="55646";
Integer innn=Integer.valueOf(str3));
int g=innn.intValue();
System.out.println(innn);*/
char c=97;
Character ct=new Character(c);
System.out.println(ct);
char c1='a';
Character ct1=new Character(c1);
System.out.println(ct1);
Character ct2=new Character('a');
System.out.println(ct2);
}
}
... {
public static void main(String[] args)
...{
int i=5;
Integer in=new Integer(i);//基本类型转化为封装类型
System.out.println(in);
int j=in.intValue();
System.out.println(in); //封装类型转化为基本类型
String str=in.toString();
System.out.println(str);//封装类型转化为String
String str1="123";
System.out.println(Integer.valueOf(str1));//String转化为封装类型
int ii=6;
Integer inn=new Integer(ii);
String str2=inn.toString();
System.out.println(str2);
/** *//**
String str3="55646";
Integer innn=Integer.valueOf(str3));
int g=innn.intValue();
System.out.println(innn);*/
char c=97;
Character ct=new Character(c);
System.out.println(ct);
char c1='a';
Character ct1=new Character(c1);
System.out.println(ct1);
Character ct2=new Character('a');
System.out.println(ct2);
}
}