Declaring Classes

Now that you have covered the concepts behind object-oriented programming, you will get down to its nuts and bolts. Most of what you do as a Java programmer involves declaring classes and interfaces and then fleshing them out with field variables and methods. Classes are declared using the following syntax:

						modifiers class ClassName extendsClause  implementsClause {
 // Class body
}

The modifiers, extends clause, and implements clause are optional. If they are supplied, they are used as follows:

  • Modifiers. A top-level class can be declared as public, final, or abstract. A public class can be accessed outside of its package. If a class is not declared as public, then only classes and interfaces that are part of the same package ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams 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.