|
|
![]() | In Java (and many other object-oriented programming languages)
classes have two purposes:
| ||||
![]() | Classes consist of a name, constructors, a set of methods,
and a set of instance variables (or attributes).
| ||||
![]() | Syntax in Java:
Modifier class Identifier { Declarations }
| ||||
![]() | The modifier is usually public for top-level classes.
| ||||
![]() | Top-level classes should be stored in files carrying their
name. The class BankAccount, for example, should be
stored into a file named BankAccount.java. This allows the
Java compiler to find the declaration of BankAccount
if it is used elsewhere.
|
|
| Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 11, 2002 |