大家帮我看看这道有意思的JAVA题??

来源:百度知道 编辑:UC知道 时间:2024/06/21 08:35:17
Integer a=100;
Ingeger b=100;
system.out.println(a==b);
是fasle还是true?

输出结果是 true
System.out.println(a==b);这句话的第一个S要大写。
对于Integer类型来说,有特殊规定:
两个Integer类型不用new去初始化时,当值在-128到127时,用==号比较的结果为true。

false, 因为a和b是两个不同的对象

true,内存中指向一致