Java, Java, Java
6. Methods: Communicating with Objects
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
Introduction
Passing Information to an Object
Constructor Methods
Retrieving Information from an Object
Passing a Value and Passing a Reference
Flow of Control: Control Structures
Testing an Improved OneRowNim Special Topic: Intelligent Agents
From the Java Library: java.lang.Object
Object-Oriented Design: Inheritance and Polymorphism
Drawing Lines and Defining Graphical Methods (Optional)
Chapter Summary
Solutions to Self-Study Exercises Exercises
101