Why does Java allow such strange code using inner class to pass compilation?
<p>Hi I tried below code while learning Java inner class. So surprising it passed compilation but could not work in run-time. My understanding is for inner class it must be instantiated in an instance of the top class. </p>

<p>But why JDK compiler allow such code to pass compilation? I am using JDK 6. </p>

<pre><code>public class Hello
{
    public Hello()
    {
        System.out.println("Simple Hello!");
    }
    public void test() 
    {
        Test.test();
    }
    protected int i = 0;
    static class B 
    {
        public B() 
        {
            System.out.println("B Hello!");
        }
        static class C 
        {
            public C()
            {
                System.out.println("C Hello!");
            }
        }
    }
}
class Test 
{
    static void test()
    {
        C c = new C();
    }
}
</code></pre>
