2.1 The Elements of Java Programs | 51turns an object of the class type. The object that is returned is an instance of the class. The
act of creating an object from a class is called instantiation.
The following definitions provide new meanings for the terms objectand class in addi-
tion to how we defined them in Chapter 1:
Class (general sense) A description of the behavior of a group of objects with similar
properties and behaviors
class(Java construct) A pattern for an objectObject (general sense) An entity or thing that is relevant in the context of a problemObject (Java) An instance of a classInstantiation Creating an object, which is an instance of a classMethod A subprogram that defines one aspect of the behavior of a classHere is the syntax diagram for a class:Our class declaration template looks identical to the template for a Java application be-
cause a Java application is just a class that has a method called main. We look specifically at
construction of an application later in this chapter. Here we are interested in those aspects
of defining a class that apply to all Java classes.
privatepublicClass-ModifiersImport-Declaration;...Class-Modifiers...Class-Declaration...Class{
class Identifier