Sunday, May 1, 2011

Inner Class Nested Levels In Java

How frequently does one see inner classes being used in an application leave aside inner classes at nested levels.
Yes one can have as many nested level of inner classes . The code below proves it.

However, the usability of this code is debatable.

public class Test{
    class a1{
        class a2{
            class a3{
                class a4{
                }
            }
        }
    }
   public static void main(String[] args) {
       Test.a1.a2.a3.a4 abc = new Test().new a1().new a3().new a4().new a6();
    }
}

No comments:

Post a Comment

Chitika