問題文
A class named Outer contains a static nested class named Inner. How does code in an unrelated class create an instance of Inner?
選択肢
- By creating an Outer first and then writing outer.new Inner(), because a nested class is tied to an instance of the class around it
- By writing new Outer.Inner(), because such a static nested class needs no instance of the class around it
- By calling a factory method on Outer, because a static nested class has no constructor that callers can reach
- By writing new Inner() after importing Outer, because a nested class becomes visible under its simple name everywhere