Java Reference
In-Depth Information
Chapter 8
Classes
Introduction
8.1 Object-Oriented
Programming
Now that you've mastered the basics of procedural-style programming in
Java, you're finally ready to explore what Java was designed for: object-
oriented programming.This chapter introduces the basic terminology that
you should use to talk about objects and shows you how to declare your
own classes to create your own objects.
Classes and Objects
Point Objects
8.2 Object State and Behavior
Object State: Fields
Object Behavior: Methods
The Implicit Parameter
Mutators and Accessors
Objects are entities that contain state and behavior and that can be used
as parts of larger programs.We'll discuss the concepts of abstraction and
encapsulation, which allow you to use objects at a high level without
understanding their inner details. We'll also discuss ideas for designing
new classes of objects and implementing the programs that utilize them.
The toString Method
8.3 Object Initialization:
Constructors
The Keyword this
Multiple Constructors
8.4 Encapsulation
Private Fields
Class Invariants
Changing Internal
Implementations
8.5 Case Study: Designing a
Stock Class
Object-Oriented Design
Heuristics
Stock Fields and Method
Headers
Stock Method and Constructor
Implementation
500
 
Search WWH ::




Custom Search