Thread: help in class |
1)what is the meaning of enclosing class...?
2) public class ABC
{ private int a;
private int b;
public static void methodName()
{
// can i interact with the instance member at here since i have declared this method as
// static .
}
}
Maybe this helps:
source: Nested Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)class OuterClass {
...
static class StaticNestedClass {
...
}
class InnerClass {
...
}
}
A nested class is a member of its enclosing class. Non-static nested classes (inner classes) have access to other members of the enclosing class, even if they are declared private. Static nested classes do not have access to other members of the enclosing class. As a member of the OuterClass, a nested class can be declared private, public, protected, or package private. (Recall that outer classes can only be declared public or package private.)
So i think here the enclosing class, is the OuterClass.
There are currently 1 users browsing this thread. (0 members and 1 guests)