Consider the following code in Main.java file:
package p; /*from www.j a va 2 s .c o m*/ private class MyClass extends java.util.HashMap { public MyClass (){ super (100); System .out.println ("MyClass created"); } } public class Main extends MyClass{ public Main (){ System .out.println ("Main created"); } public static void main (String [] args){ new Main (); } }
What will be the output when Main is run?
Select 1 option
Correct Option is : E
The file will not compile because MyClass is a top level class and private is not a valid access modifier for a top level class. private can be applied to an inner class.