June 2004
Intermediate to advanced
848 pages
21h 28m
English
Nested static classes are the simplest of the nested classes to write, understand, and use. Table 12-1 shows how to create a nested static class. You simply write the declaration of your class in the usual way, give it the modifier static, and put it inside a top-level class.
Table 12-1. Creating a nested static class
|
Java term |
Description |
Example code |
|---|---|---|
|
Nested static class |
class Top { static class MyNested { }} |
A nested class that is declared “static.” This acts like a top-level class. |
You recall that static means “there is only one of these”. A static thing is not tied to an individual instance object. If you think about it, there is only one of any ...
Read now
Unlock full access