Usually, we can identify all the classes, methods & data members by seeing their signatures.
Ex: Math.sqrt(), System.out.println
Math - class
sqrt - static method
print/println - instance method
But Not able to identify static methods of nested classes.
package so;
class Outer {
static String outerVar = "ABC";
class InsInner {
static void show() {
System.out.println("Instance inner "+outerVar);
}
}
static class StaticInner {
static void show() {
System.out.println("Static inner class static method "+outerVar);
}
}
}
public class NestedClass {
public static void main(String[] args) {
Outer.InsInner.show();
Outer.StaticInner.show();
}
}
Why both static and non static classes have same convention?
Outer.InsInner.show();
Outer.StaticInner.show();