4.2. Defining Classes

A class declaration introduces a new reference type. It has the following general syntax:

<class modifiers> class <class name>               <extends clause> <implements clause>  // Class header{ // Class body     <field declarations>     <method declarations>     <nested class declarations>     <nested interface declarations>     <constructor declarations>     <initializer blocks>}

In the class header, the name of the class is preceded by the keyword class. In addition, the class header can specify the following information:

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.