The static nested class is one of the four nested classes that I briefly discussed in my Introduction to Nested Classes tutorial. A static nested class is defined at the member level and must have the keyword static in the declaration.
class Standard {
String s = "";
static class StaticNested {
int i = 0;
}
}
The first thing to understand about an nested static class is that you do not need an instance of either the outer class or the nested static class in order to access its members. You can directly access static methods and variables without creating an object. If you would like to create an instance of a nested static class you do not need an instance of the outer class in order to do so.
Auf dieser Seite können Sie das Online-Video Learn Java Programming - Static Nested Classes Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Daniel Ross 13 Januar 2016 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 5,134 Mal angesehen und es wurde von 64 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!