java面试题目..
(1)
class Number{
int i;
}
public class aa{
public static void main(String[] args) {
Integer n1 = new Integer(48);
Integer n2 = new Integer(48);
//(1)
System.out.println(n1 == n2);
//(2)
System.out.println(n1.equals(n2));
//(3)
Number n3 = new Number();
Number n4 = new Number();
n3.i = 30;
n4.i = 30;
System.out.println(n3.equals(n4));
}
}
(2)
public class bb{
public static void main(String[] args){
int m = -1;//-11呢?
System.out.println(m > > > = 10);
long n = -1;
System.out.println(n > > > = 10);
short s = -1;
System.out.println(s > > > = 10);
byte b = -1;
System.out.println(b > > > = 10);
}
}
------解决方案--------------------1:
false
true
true
2:
4194303
18014398509481983
-1
-1
------解决方案--------------------1:
false
true
false
------解决方案--------------------> > > = 这个符号什么意思?
------解决方案--------------------false
true
false
4194303
18014398509481983
-1
-1
------解决方案--------------------1:
false
true
false