Basically, a class can have fields, constructors, methods and nested types. The following pseudocode shows the skeleton of a Java class:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[Modifiers] class ClassName [extends OnlyOneSuperClass] [implements InterfaceList] { // fields [Modifiers] type variableName; // constructors [Modifiers] ClassName([ParameterList]) [ExceptionList] {…} // methods [Modifiers] returnType methodName([ParamList]) [ExceptionList] {…} // nested types [Modifiers] (class|interface|enum) NestedTypeName {…} } |
[ ] = optional, | = or You will learn about modifiers, constructors, methods and nested types later in the topic 6 lessons. For now, knowing that a Java class ..Continue Reading