I created a nested static class like this:
public class OuterClass {
public static class NestedClass {
public static String getName() {
//Some stuff
return "Name";
}
}
//Now am not able to call the method *getName()* inside *OuterClass*
NestedClass.getName(); //Compile complains here
}
But I can do it from another class
public class TestOuterClass {
public void testName() {
OuterClass.NestedClass.getName();
}
}
I don't understand why it doesn't work withen the class its been defined.