我的理解下面的代碼應該運行沒有任何編譯錯誤。編譯失敗,通用類與通用接口
但是,當我運行這個程序時,我收到以下編譯錯誤。
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];
}
請幫助我理解這種行爲。
爲了記錄:我從您的示例中刪除了第一個A類 - 因爲該類不會導致整體問題。所以我覺得它很混亂。 – GhostCat
@ GhostCat-謝謝。 –