
3.15 The Integer,Double, and Other Wrapper Classes
In Chapter 2, we discussed primitive data types and how they can be used
in a program. In this chapter, we’ve discussed classes and class methods and
how useful and convenient classes are in representing and encapsulating
data into objects.
Most programs use a combination of primitive data types and objects.
Some class methods, however, will accept only objects as arguments, so we
need some way to convert a primitive data type into an object. Conversely,
there are times when we need to convert an object into a primitive data
type. For example, let’s say we have a Graphical User Interface where we ask ...