aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes basic doubt regarding == Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "basic doubt regarding ==" Watch "basic doubt regarding ==" New topic
Author

basic doubt regarding ==

Pandharinath Barve
Greenhorn

Joined: Aug 04, 2006
Posts: 13
Integer i = 127;
Integer j = 127;
if (i == j){
System.out.println("Same");
}
else{
System.out.println("different");
}
output = same.

Integer i = 128
Integer j = 128;
if (i == j){
System.out.println("Same");
}
else{
System.out.println("different");
}
output = different.

Please explain why ?


With Best Regards,<br />Pandharinath.<br />SCJP 5.0
Srinivas Kumar
Ranch Hand

Joined: Jul 14, 2005
Posts: 52
Question is already repeated in the forum.
please see the link
http://www.coderanch.com/t/262155/java-programmer-SCJP/certification/equals
Pandharinath Barve
Greenhorn

Joined: Aug 04, 2006
Posts: 13
Can you please explain me in detail..
Pandharinath Barve
Greenhorn

Joined: Aug 04, 2006
Posts: 13
I got it, thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: basic doubt regarding ==