What does it mean for a non generic class to extend a generic class

后端 未结 6 2079
广开言路
广开言路 2021-02-04 10:23
6条回答
  •  有刺的猬
    2021-02-04 10:41

    In this case, C is a class that can take a generic parameter, and you are giving it a specific type A as the parameter. Then, B extends that specific parameterization of C.

    For example, suppose:

    class C {
        T example();
    }
    
    class B extends C {
    }
    

    Then B.example() would return an Integer.

提交回复
热议问题