2.1. IntroductionThis chapter introduces some more of the basic principles of object-oriented programming. We begin by looking at some examples of creating and using objects of type String and Graphics. Then we examine how user-defined classes are used by doing a detailed walkthrough of the Riddle class we saw in Chapter 1. We focus on the basic Java language elements involved. By the end of these sections, you should know how to identify the key elements that make up a Java program. We then present a detailed example of the program-development process by designing and implementing a class that models a certain two-person game. The design is represented using UML notation. |