다음은 클래스 외부에서 호출되는 멤버 내부 클래스의 예입니다.내부/외부 클래스 obj.new
//Program of memeber inner class that is invoked outside a class
class Outer {
private int data=10;
class Inner {
void msg() {
System.out.println("Data: " + data);
}
}
}
class Test {
public static void main(String args[]) {
Outer obj=new Outer();
Outer.Inner in = obj.new Inner();
in.msg();
}
}
사람이 코드 행 explane 수 : Outer.Inner in = obj.new Iner()
을; obj.new Inner()
의 의미는 무엇입니까? outer
객체는 Iner
클래스의 객체를 생성하는의 참조를 사용