Dot notation is used to refer to an object's public elements.
Designing a class is a matter of deciding what role it will play and what information and actions it will have.
Writing a Java program is a matter of defining one or more classes. A class definition serves as a template for creating instances of the class.
Classes typically contain two kinds of elements, variables and methods. An object's state is defined by its instance variables.
Class elements declared public can be accessed by other objects. Elements declared private are hidden from other objects.
A class's instance variables are usually declared private and so cannot be accessed directly by other objects.
An object's public instance methods can be called by other objects. Thus, they make up the object's interface with other objects.
Object instantiation is the process of creating an object, using the new operator in conjunction with a constructor method.
A class definition consists of a header and a body. The header gives the class a name, and specifies its accessibility (public) and its place in the Java class hierarchy (extends Object). The class body contains declarations of the class's variables and definitions of its methods.
By default, a newly defined class is considered a subclass of Object.
Class elements declared static, such as the main() method, are associated with the class (not with its instances).
A Java application program must contain a main() method, which is where it begins execution.
Methods used solely for the internal operations of the class should be declared private.
An instance variable declaration reserves memory for the instance variable within the object, associates a name and a type with the location, and specifies its accessibility.
A method definition consists of two parts: a header, which names the method and provides other general information about it, and a body, which contains its executable statements.
Declaring a variable creates a name for an object but does not create the object itself. An object is created by using the new operator and a constructor method.