This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

small doubt

 
vivek gaur
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) what does 'instanceof' operator mean?
2) what actually happens if we remove static from main?
3) when do we use Wrapper classes and why?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) instanceOf will tell you the type is an object is of any particular type.
For example :

means "if myCar is a Car class or subclass then"

2) try it yourself

3) Wrapper classes offer useful methods. Have a look at the Integer class. You can convert a number into hexadecimal, octal, binary, double, float....
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
3) Wrapper classes are often used when you need an Object but you have a primitive type instead. For example, you can "wrap" an int into an Integer in order to store it in a Collection.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic