Which statements about the following program are true?.
public class Outer { public void doIt() { }//from www . j av a 2s . com public class Inner { public void doIt() { } } public static void main(String[] args) { new Outer().new Inner().doIt(); } }
Select the two correct answers.
doIt()
method in the Inner class overrides the doIt()
method in the Outer class.doIt()
method in the Inner class overloads the doIt()
method in the Outer class.doIt()
method in the Inner class hides the doIt()
method in the Outer class.(c) and (d)
The class Inner is a non-static member class of the Outer class and its full name is Outer.Inner.
The Inner class does not inherit from the Outer class.
The method named doIt is, therefore, neither overridden nor overloaded.
Within the scope of the Inner class, the doIt()
method of the Outer class is hidden by the doIt()
method of the Inner class.