Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Autoboxing can automatically wrap the primitive type to the corresponding wrapper object, which can be convenient in many cases and avoid clutters in your own code. But you should always be careful about this process, especially when comparision. Considerthe follwing comparison. Consider the following code:

Noncompliant code Example

...

Chapter 5, Core Java™ 2 Volume I - Fundamentals, Seventh Edition By Cay SCay S. Horstmann Horstmann, Gary Cornell Gary Cornell 

Publisher:Prentice Hall PTR;Pub Date:August 17, 2004