Originally posted by harish shankarnarayan:
1.Integer ten=new Integer(10);
2.Long nine=new Long (9);
3.System.out.println(ten + nine);
4.int i=1;
5.System.out.println(i + ten);
wats the output and why??
wat i felt that ter would be an error at line 5
we r adding primitive to an Wrapper object buti think this compiles fine why???
The code wont compile. You will get compilation errors like:
operator + cannot be applied to java.lang.Integer,java.lang.Long
System.out.println(ten + nine);
^
operator + cannot be applied to int,java.lang.Integer
System.out.println(i + ten);
^