Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need explanation on wrapper class

 
praveen kumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 980
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic