Java Reference
In-Depth Information
Although there is no syntactic rule that enforces it, a well-designed class should define
one and only one logical entity. For example, a class that stores names and telephone
numbers will not normally also store information about the stock market, average rainfall,
sunspot cycles, or other unrelated information. The point here is that well-designed class
groups logically connected information. Putting unrelated information into the same class
will quickly destructure your code!
Up to this point, the classes that we have been using have had only one method: main(
) . Soon you will see how to create others. However, notice that the general form of a class
does not specify a main( ) method. A main( ) method is required only if that class is the
starting point for your program. Also, some types of Java applications, such as applets,
don't require a main( ) .
Defining a Class
Search WWH ::




Custom Search