Is it possible for a regular inner class to have same name as outer class?
Does same rule apply to static inner classes?
Bhushan Damle
Greenhorn
Joined: Nov 28, 2004
Posts: 21
posted
0
compile following code and see the error public class InnerClass { public void show() { System.out.println("Hye-Bye"); } public static void main(String args[]) {
new InnerClass().show(); class InnerClass { public void show() { System.out.println("Hello"); } }
} }
now compile this code and execute & see the output public class InnerClass { public static void main(String args[]) {
class Inner { public void show() { System.out.println("Hello"); } } new Inner().show(); }