Murach's Beginning Java 2, SDK 1.4

This chapter shows how to code classes that define objects and how to create objects from these classes.

Chapter 4 How to write object-oriented programs
An introduction to object-oriented programming 108
How encapsulation works 108
The relationship between a class and its objects 110
How to code a class that defines an object 112
The code of the Book class 112
How to code instance variables 114
How to code constructors 116
How to code methods 118
How to create an object from a class 120
The code of the BookApp class 120
How to create an object 122
How to call the methods of an object 124
The object-oriented code of the Book Order application 126
The code of the BookOrder class 126
The code of the BookOrderApp class 128
The benefits and shortcomings of object-oriented programming 128
How to create and use static fields and methods 130
How to create static fields and methods 130
How to call static fields and methods 132
How to code a static initialization block 134
When to use static fields and methods 134
How to work with packages 136
How to create and compile packages 136
How to make packages available to other classes 138
How to use javadoc to document a class 140
How to add javadoc comments to a class 140
How to generate the documentation for a class 142
How to view the documentation for a class 142
Perspective 144
t




Murach's Beginning Java 2

Learn more about this book

Add this book to your cart


See the Java 1.5 edition