3.1 Introduction1

In Chapter 2, you worked with existing classes, objects and methods. You used the predefined standard output object System.out, invoking its methods print, println and printf to display information on the screen. You used the existing Scanner class to create an object that reads into memory integer data typed by the user at the keyboard. Throughout the book, you’ll use many more preexisting classes and objects—this is one of the great strengths of Java as an object-oriented programming language.

In this chapter, you’ll create your own classes and methods. Each new class you create ...

Get Java How to Program, Early Objects, 11th 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.