Compilation fails for Generic class with Generic Interface

Viewed 550

To my understanding following code should run without any compilation error.

However, when I run this program I am getting following compilation error.

The member type B.D cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type B

class B<X> {
    interface C {
    }

    interface D<Y> {
    }
}

class Test {
     // compilation fails here
    B<String>.D<String>[] arr = new B<String>.D<String>[10];
}

Please help me understand this behavior.

3 Answers
Related