Yes. A big program might need thousands of objects as it runs, but might have only a few dozen class descriptions.
Class definitions look like this:
modifiers† class ClassName
{
Descriptions of the constructors that initialize a new object,
the instance variables, and the methods of an object.
}
Often programmers separate the definition into three sections:
modifiers† class ClassName
{
// Description of the instance variables
// Description of the constructors
// Description of the methods
}
†For now, modifiers will be public
in the class that contains main.
See next page.
Separating the class into sections is done for clarity. It is not a rule of the language.
A simple class might have just a few variables and be defined in just a few lines of code. A large, complicated class might take thousands of lines of code for its definition.
Does each object require a main() method?