OBJECTIVES
After studying this chapter, you will
Be familiar with using variables to store and manipulate simple data.
Be familiar with creating and using objects.
Understand the relationship between classes and objects.
Understand the difference between objects and data of primitive type.
Understand the difference between static and instance elements of a class.
Be able to understand and design a simple class in Java.
Understand some of the basic principles of object-oriented programming.
OUTLINE
2.1
Introduction
2.2
Using String Objects
2.3
Drawing Shapes with a Graphics Object (Optional)
2.4
Class Definition
2.5
CASE STUDY: Simulating a Two-Person Game
Alan Kay and the Smalltalk Language
2.6
From the Java Library: java.util.Scanner
Chapter Summary
Solutions to Self-Study Exercises
Exercises