The code for each class is stored in a *.java file.
public|private class ClassName
{
statements
}
Two access modifiers are present public and private.
The *.java file must match the ClassName.
There must be atleast one public class in an application.
Naming the class:
-
Start the name with a capital letter.
-
Start every word within a class name with an inital capital letter.
-
Use letters and digits only.
-
Each class name should be a noun or a noun that's preceded by one or more adjectives.
We will use the format of:
-
Invoice – indicates you must create an instance of the class.
-
InvoiceApp – indicates this class contains a main.
-
CustomerInvoice – More specific class name.