Introduction: Using Classes and Objects
We introduce this chapter by providing the prerequisites, learning objectives, and overview.
We'll cover the following...
We'll cover the following...
Prerequisites
Objectives
After completing this chapter, you should be able to
- Describe how a variable of a primitive type differs from a variable of a class type in the way they represent data
- Use the operator
newto create an object - Use methods within the class
Stringto manipulate strings - Use the class
Scannerto extract portions of a string - Use the class
Dateto create and compare twoDateobjects - Use the class
BigDecimalto perform decimal arithmetic - Use a wrapper class such as
Integerto represent primitive data as an object - Use the method
parseIntin the classIntegerto convert a string containing an integer to anint - Use constants in the class
Integerto discover the minimum and maximum values of anint - Use the class
Randomto generate random numbers - Use the class
DecimalFormatto format numerical output
Overview
Our first chapter introduced the notion of an object, but in this chapter, we will look at the concept in detail. We will introduce several classes that are standard in the Java Class Library and show you how to use them. Our goal is to familiarize you with objects and their behaviors.