아무도 아래 코드가 작동하지 않는 이유를 말해 줄 수 있습니까?Java의 중첩 클래스
public class NestedClassPrac {
public static class Nested {
public void sayHello() { System.out.println("First nested class~");}
public static class LittleNested {
public void sayHello() { System.out.println("this is why we are nested class");}
}
}
public static void main(String[] args) {
Nested a = new Nested();
a.sayHello();
LittleNested b = new LittleNested();
b.sayHello();
}
}
오류 메시지 :
NestedClassPrac.java:13: cannot find symbol
symbol : class LittleNested
location: class NestedClassPrac
LittleNested b = new LittleNested();
^
NestedClassPrac.java:13: cannot find symbol
symbol : class LittleNested
location: class NestedClassPrac
LittleNested b = new LittleNested();
^
2 errors
와우, 감사합니다! 알았다. – shanwu