A type defines both data and operations on that data.
A Java class can be used to define a new type.
Variables can then be defined of that class type.
Each variable can have its own instance value of the class type.
-
The class has data members that are not static. These are called instance members.
-
Variables can be declared of this class type.
-
Values can be created and assigned to such variables. Each variable will have its own separate set of instance data members.
So unlike static data members of a class, instance members are not shared.
-
The methods of a class that defines a type are not static. These are called instance methods.
An instance method operates on the instance data of the instance used to call it.
Instance data members of the class are accessible to each of the instance methods (but not to any static methods).
-
Typically such a class is not used as an application and so doesn't need a main method.
Instead, some application class will use a class like this. For example, an application class may declare, create and use an instance of this class type.