The general syntax for declaring a class in Java is
<modifiers> class ClassName { // Class Body }
Item | Description |
---|---|
<modifiers> | keywords with special meanings. A class declaration may have zero or more modifiers. |
class | keyword. declare a class. |
ClassName | a user-defined name of the class, must be a valid identifier. |
class body | specified inside a pair of braces {}. The body of a class contains its different components, for example, fields, methods, etc. |
The following code defines a class named Employee with an empty body.
Employee class does not use any modifiers.
class Employee { // Empty body for now }