Skip to main content
O'Reilly home
    • Sign In
    • Try Now
    • Teams
    • Individuals
    • Features
      • Certifications
      • Interactive learning
      • Live online sessions
    • What’s New
    • O’Reilly for marketers

Java For Everyone: Compatible with Java 5, 6, and 7, 2nd Edition by

Get Java For Everyone: Compatible with Java 5, 6, and 7, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.

Start your free trial

CHAPTER 8

OBJECTS AND CLASSES image

CHAPTER GOALS

To understand the concepts of classes, objects, and encapsulation

To implement instance variables, methods, and constructors

To be able to design, implement, and test your own classes

To understand the behavior of object references, static variables, and static methods

CHAPTER CONTENTS

8.1 OBJECT-ORIENTED PROGRAMMING

8.2 IMPLEMENTING A SIMPLE CLASS

Syntax 8.1: Instance Variable Declaration

8.3 SPECIFYING THE PUBLIC INTERFACE OF A CLASS

Special Topic 8.1: The javadoc Utility

8.4 DESIGNING THE DATA REPRESENTATION

8.5 IMPLEMENTING INSTANCE METHODS

Syntax 8.2: Instance Methods

Programming Tip 8.1: All Instance Variables should Be Private; Most Methods should Be Public

8.6 CONSTRUCTORS

Syntax 8.3: Constructors

Common Error 8.1: Forgetting to Initialize Object References in a Constructor

Common Error 8.2: Trying to Call a Constructor

Common Error 8.3: Declaring a Constructor as void

Special Topic 8.2: Overloading

8.7 TESTING A CLASS

How To 8.1: Implementing a Class

Worked Example 8.1: Implementing a bank Account Class image

Video Example 8.1: Paying Off a loan image

8.8 PROBLEM SOLVING: TRACING OBJECTS

8.9 PROBLEM SOLVING: PATTERNS FOR OBJECT DATA

Video Example ...

Get Java For Everyone: Compatible with Java 5, 6, and 7, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.

Start your free trial

About O’Reilly

  • Teach/write/train
  • Careers
  • Community partners
  • Affiliate program
  • Diversity

Support

  • Contact us
  • Newsletters
  • Privacy policy
facebook-logo linkedin-logo youtube-logo

Download the O’Reilly App

Apple app store Google play store

Take O’Reilly online learning with you and learn anywhere, anytime on your phone and tablet.

  • Get unlimited access to books, videos, and live training.
  • Sync all your devices and never lose your place.
  • Learn even when there’s no signal with offline access.

Do not sell my personal information

Exercise your consumer rights by contacting us at donotsell@oreilly.com.

O'Reilly home

© 2021, O’Reilly Media, Inc. All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.

Terms of service • Privacy policy • Editorial independence