CHAPTER 30 — Defining Your Own Classes

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to home page   go to next page

created: 11/13/98; revised: 09/12/99, 06/13/00, 07/27/02, 08/18/03, 01/19/06

CHAPTER 30 — Defining Your Own Classes

The previous chapters have discussed how to use objects and their methods. The objects were constructed using classes from the Java libraries. This chapter discusses how to define your own classes and construct objects using them.

Chapter Topics:

  • Object Oriented Programming
  • Syntax of Class Definitions
  • Syntax of Method Definitions
  • The return statement
  • The void return type
  • Object Oriented "Hello World" example
  • Classes for Testing

QUESTION 1:

(Review:) what is the difference between a class and an object?