Learn Java Programming - Static Nested Classes Tutorial

Описание к видео Learn Java Programming - Static Nested Classes Tutorial

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.

Комментарии

Информация по комментариям в разработке