java generics, how to extend from two classes?

后端 未结 3 1927
北荒
北荒 2021-01-27 05:15

I want to have a Class object, but I want to force whatever class it represents to extend class A and also class B. I can do



        
3条回答
  •  伪装坚强ぢ
    2021-01-27 05:41

    A simple way for this problem is inheritance.

    public class A { // some codes }
    
    public class B extends A { }
    
    
    

提交回复
热议问题