Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple question  RSS feed

 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone expalin me difference betwen
Boolean bar =new Boolean() and
boolean bar;

with example pls....
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Boolean bar =new Boolean() : this is an instance of the Boolean class
boolean bar : this is a boolean primitive

Look at Boolean and you can see all the methods available to the Boolean instance.
For example bar.booleanValue() will return the value of the Boolean instance.

The primitive "boolean bar" has no methods, only a value of true or false.

Maybe you should read something on Class and Primitives, or on Wrapper Classes.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!