Integer数据和int数据之间的区别;
来源:互联网 发布:淘宝网站策划 编辑:程序博客网 时间:2024/06/03 06:42
// Integer类;
//********构造方法*********************
int n=3;
Integer i1=new Integer(n);
System.out.println(i1);
String s=”111”;//数字类型;
Integer i2=new Integer(s);
System.out.println(i2);
//***********自动拆箱装箱********************
//拆箱由引用数据类型转换成基本数据类型;
// Integer —>int
//Interger可以创建对象,而int不可以,只能代表数据;
//装箱由基本数据类型转换成引用数据类型;
// int——>Integer
//**************转换功能****************
//自动转换;大—-《小
short st2=3;
char c=’a’;
int n1=st2;
int n2=c;
double d=n2;
//强制转换;大—》小
short st=12;
short st1=(short)(st+3);
char c1=(char)97;
System.out.println(c1);//a
//字符串转换成int;
String s3=”333”;//数字型;将字符串参数作为有符号的十进制整数进行解析。
int n3=Integer.parseInt(s3);
System.out.println(n3);//333;
System.out.println(Short.MAX_VALUE); System.out.println(Short.MIN_VALUE);}
}
- Integer数据和int数据之间的区别;
- spring数据绑定中使用Int和Integer的区别
- int 和 Integer 的区别
- int 和 Integer 的区别
- int和Integer的区别
- int和Integer的区别
- int 和 integer的区别
- Integer和int的区别
- Integer 和 int 的区别
- int和integer的区别
- int和Integer的区别
- int 和integer的区别
- int 和 Integer的区别
- int 和integer的区别
- int 和integer的区别
- Integer和Int的区别
- int 和integer的区别
- int 和integer的区别
- eclipse实用方法--快捷键
- Visual Studio Code修改HTML Snippets插件中默认模板内容
- 九度[1038]-Sum of Factorials
- Lua 环境安装
- HDU 4055 Number String(计数dp)
- Integer数据和int数据之间的区别;
- 【整洁之道】如何写出更整洁的代码(上)
- 1331:局部最大值
- 阿拉伯数字转汉字
- 12个前端初学者必会技能
- Ajax的简单基础
- 黑盒测试:测试用例的设计方法
- 关于 java web的一些基本概念
- 建造者模式