File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Autoboxing and == operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Autoboxing and == operator" Watch "Autoboxing and == operator" New topic
Author

Autoboxing and == operator

Arkadiusz Przechodzki
Greenhorn

Joined: Sep 04, 2007
Posts: 5
Welcome,




Output: no yes

WTF?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

JLS - 5.1.7 Boxing Conversion...
If the value p being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2.

Note that the above applies only to boxed values. Creating wrapper instances with "new" is different.

(Also, for the benefit of all users, please use real words instead of text abbreviations. Thanks!)


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Autoboxing and == operator
 
Similar Threads
Creation of Ineger Wrapper Object
Wrappers question
Doubts on == given in B&B
== Vs .equals()
Integer unboxing and == operator question