Chapter 7. Using Methods to Accomplish Tasks

Methods are arguably the most important part of any object-oriented language, because they define every action an object takes.

Classes and objects provide a framework. Class and instance variables provide a way to describe what these classes and objects are. Only methods can define an object's behavior—the things it is capable of doing and the way it interacts with other classes and objects.

Yesterday, you learned some things about defining methods, and you could use this knowledge to create Java programs. You would, however, be missing some features that make methods powerful—features that make your objects and classes more efficient and easier to understand. Today you learn about the following features: ...

Get Sams Teach Yourself Java™ 2 Platform in 21 Days Professional Reference Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.