This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes need explanation on wrapper class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "need explanation on wrapper class" Watch "need explanation on wrapper class" New topic
Author

need explanation on wrapper class

praveen kumar
Greenhorn

Joined: Sep 02, 2005
Posts: 4
can anyone explain me the output of the follwing program:
public class Test{
public static void main(String args[]){
Byte b1=new Byte("1");
if(b1.toString()==b1.toString())
System.out.println("true");
else
System.out.println("false");

Byte b=new Byte("19");
if(b.toString()==b.toString())
System.out.println("true");
else
System.out.println("false");

}
}

The output is:
true
false
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 973
HI

CHECK OUT this link...

http://www.coderanch.com/t/250475/java-programmer-SCJP/certification/toString-Integer-class


Regards
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: need explanation on wrapper class
 
Similar Threads
Byte and String
comparison
Byte class(Wrapper class)
toString() behaviour?
Understanding Byte and == Op