August 2004
Intermediate to advanced
480 pages
9h 41m
English
You can have multiple class files in the same source (.java) file, but only one of them may be declared public.
public class MyClass {
// class definition here
}
class AnotherClass {}
You can add class modifiers to the declaration that changes the definition of the class.
This class modifier indicates that you want it to be available to classes other than just those in the package in which it is declared. That is, you'll let anybody use it. If your class does not include the public modifier, it can only be used by other classes within the same package.
To make your class so it cannot ever be subclassed, you include the final modifier in the class declaration. This example is from the standard API. ...
Read now
Unlock full access