Title: Key Concept - Class
Course: CPS 189: Java Certification - Review, Practice & Prepare (Development) > Section: Learning Modules

A class is a blueprint or prototype from which objects are created.

A (top level, not nested) class is declared with the following:

- Optional modifier public or package-private (no modifier).
- The keyword class.
- The class name.
- Optional keyword extends indicating the class's parent.
- Optional keyword implements followed by one or more interfaces.
- The class body consisting of one or more constructs, fields, and methods, enclosed by curly braces.

Class syntax:

[<access-modifier>] class <class-name> [<<generic-list>>]
[extends <superclass-name>] [implements <interface-list>]
{
<class-body>
}

Where:
<access-modifier> is one of 'public' or blank.

<class-body> is any combination of the following:
<field-declarations>
<method=declarations>
<nested-class-declarations>
<nested-interface-declarations>
<nested-enum-declarations>
<constructor-declarations>
<initializer-blocks>