A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Joined: Sep 16, 2006
Sep 17, 2006 03:04:00
output should be "ij" but it only prints j why? if someone help me
Joined: May 02, 2006
Sep 17, 2006 03:06:00
creates an object on a heap. This is why 'i' is not printed out.
[ September 17, 2006: Message edited by: Aniket Patil ]
SCJP 5.0 | SCWCD 1.4 <br /> <br />If you don't know where you are going, any road will take you there!
Joined: Sep 17, 2006
Sep 17, 2006 03:17:00
i==new Integer(10) creat a new Integer object,and "==" is used for checking the reference not the meaningful object's value.
Try equals(),and then it will do that!
SCJP1.4 93%<br />SCWCD��
I agree. Here's the link:
subject: Integer Problem
please explain the concept behind this
Question on ==, equals()
doubt about boxing conversions
How to check the type of a variable
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015