previous | start | next

Syntax 3.3 : Class Definition

 
accessSpecifier class ClassName
{
   constructors
   methods
   fields
}

Example:

 
public class BankAccount
{
public BankAccount(double initialBalance) { . . . }
public void deposit(double amount) { . . . }
. . .
}

Purpose:

To define a class, its public interface, and its implementation details


previous | start | next