Chapter 7. Classes

If you are unfamiliar with object-oriented programming, you might find talk about classes and objects rather mysterious. In reality classes are not all that complicated to understand. A class is a named block of code that defines a reference type. The class is the basic building block of all Java programs. The class provides the structure or blueprint for objects. An object is an instance of a class.

Classes will, in general, consist of members (fields, methods, and nested classes and interfaces), initializers (both instance and static), and constructors. The fields define the data structure of the class. The methods will generally be used to access and manipulate the fields. Initializers and constructors are normally used to ...

Get Technical Java™: Developing Scientific and Engineering Applications 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.