OBJECTIVES
After studying this chapter, you will
Understand the role that methods play in an object-oriented program.
Know how to use parameters and arguments to pass data to an object.
Understand how constructor methods are used to instantiate objects.
Know the difference between passing a value and passing a reference to an object.
Be able to design your own methods.
Know how to use the if-else and while control structures.
OUTLINE
3.1
Introduction
3.2
Passing Information to an Object
3.3
Constructor Methods
3.4
Retrieving Information from an Object
3.5
Passing a Value and Passing a Reference
3.6
Flow of Control: Control Structures
3.7
Testing an Improved OneRowNim
Intelligent Agents
3.8
From the Java Library: java.lang.Object
3.9
Object-Oriented Design: Inheritance and Polymorphism
3.10
Drawing Lines and Defining Graphical Methods (Optional)
Chapter Summary
Solutions to Self-Study Exercises
Exercises