O'Reilly logo

The Java® Tutorial: A Short Course on the Basics, 6th Edition by Sharon Biocca Zakhour, Joni Gordon, Sowmya Kannan, Scott Hommel, Raymond Gallardo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Classes and Objects

With the knowledge you now have of the basics of the Java programming language, you can learn to write your own classes. In this chapter, you will find information about defining your own classes, including declaring member variables, methods, and constructors. You will learn to use your classes to create objects, and how to use the objects you create. This chapter also covers nesting classes within other classes, and enumerations

The first section shows you the anatomy of a class, and how to declare fields, methods, and constructors. The second section covers creating and using objects. You will learn how to instantiate an object, and, once instantiated, how to use the dot operator to access the object’s instance ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required