首页 > 试题广场 >

int 和 Integer 有什么区别

[问答题]
请你说明一下int 和 Integer 有什么区别
int是基本数据类型, Integer是包装类 。int的速度快,Integer的速度慢。int放在栈中,Integer放在堆中。int初始值为0,Integer初始值为null。
发表于 2019-01-13 12:37:23 回复(0)
1.int是基本数据类型,Integer是引用数据类型。 2.int默认值是0,Integer默认是null 3.int存储在栈中,Integer存储在堆中 4.int变量存储的数据的原始值,Integer变量存储的是引用地址 5.Integer通过实例化创建的,是对象
发表于 2019-03-07 13:35:12 回复(0)
Int是java提供的八大基本类型之一。 Integer是int的封装类。 Int的默认值是0,integer的默认值是null。
发表于 2019-05-08 10:38:31 回复(0)
int是基本类型,Integer是包装类型。
发表于 2019-05-05 09:33:48 回复(0)
1.int是基本数据类型, Integer是包装类 。 2.int的速度快,Integer的速度慢。 3.int放在栈中,Integer放在堆中。 4.int初始值为0,Integer初始值为null。
发表于 2019-04-30 22:39:34 回复(0)
int是基本类型,Integer是它的包装类型
发表于 2019-04-26 23:36:23 回复(0)
Integer是int的包装类,int初始值为0 Integer的初始值为null
编辑于 2019-04-26 20:04:26 回复(0)
Int是java的原始数据类型,Integer是java为int提供的封装类。
发表于 2019-04-26 20:02:19 回复(0)
1.int是基本数据类型, Integer是包装类 。
2.int的速度快,Integer的速度慢。
3.int放在栈中,Integer放在堆中。
4.int初始值为0,Integer初始值为null。
发表于 2019-04-25 20:27:05 回复(0)
int是基本类型,Integer是包装类型。
发表于 2019-04-25 18:57:01 回复(0)
int是基本数据类型, Integer是包装类 。int的速度快,Integer的速度慢
发表于 2019-04-25 17:50:12 回复(0)

Int是Java八大数据类型之一,而integer是int的包装类,int的默认值问0,integer的默认值为null,也就是说integer可以区分出未赋值和值为0的区别,而int则无法表达出为赋值的情况来。

例如:要表达出没有参加考试和考试成绩为0的区别,则只能使用integer。在jsp开发中,integer的默认值为0,所以用el表达式在文本框显示时,值为空白字符串,而用int的话,文本框显示的为0,所以int不适合作为web层的表单数据类型。

发表于 2019-04-17 16:05:26 回复(0)
int是基本数据类型,integer是int的包装类,int变量的默认初始值为0,而integer变量默认初始值为null
发表于 2019-03-05 22:16:40 回复(0)