public class WrapperTest { public static void main(String[] args) { int i1 = 10; Integer i11 = new Integer(i1); System.out.println(i11); float f1 = 12.3F; f1 = 32.2F; Float ff1 = new Float(f1); System.out.println(ff1); String s1 = "32.1"; Float ff2 = new Float(s1); System.out.println(ff2); boolean b1 = true; Boolean bb1 = new Boolean(b1); System.out.println(bb1); String s2 = "TRue"; Boolean bb2 = new Boolean(s2); System.out.println(bb2); String s3 = "dasdcvz"; Boolean bb3 = new Boolean(s3); System.out.println(bb3); int i2 = 10; Integer ii2 = Integer.valueOf(i2); Boolean b2 = Boolean.valueOf(true); Float f2 = Float.valueOf(12.3F); Integer ir1 = new Integer(10); int iu = ir1.intValue(); System.out.println(iu); int ire = 12; Integer po = ire; int up = 0; up = po; System.out.println(up); } }
public class WrapperTest
{
public static void main(String[] args)
{
int i1 = 10;
Integer i11 = new Integer(i1);
System.out.println(i11);float f1 = 12.3F;
f1 = 32.2F;
Float ff1 = new Float(f1);
System.out.println(ff1);String s1 = "32.1";
Float ff2 = new Float(s1);
System.out.println(ff2);boolean b1 = true;
Boolean bb1 = new Boolean(b1);
System.out.println(bb1);String s2 = "TRue";
Boolean bb2 = new Boolean(s2);
System.out.println(bb2);String s3 = "dasdcvz";
Boolean bb3 = new Boolean(s3);
System.out.println(bb3);int i2 = 10;
Integer ii2 = Integer.valueOf(i2);
Boolean b2 = Boolean.valueOf(true);
Float f2 = Float.valueOf(12.3F);Integer ir1 = new Integer(10);
int iu = ir1.intValue();
System.out.println(iu);文章来源:https://www.toymoban.com/news/detail-433054.htmlint ire = 12;
Integer po = ire;
int up = 0;
up = po;
System.out.println(up);
}
}文章来源地址https://www.toymoban.com/news/detail-433054.html
到了这里,关于JAVA包装类和基本数据类型------JAVA入门基础教程的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!