implements vs extends in generics in Java

前端 未结 3 2121
长发绾君心
长发绾君心 2020-12-29 08:09

Can someone tell me what the differences between the first and second codes are? MaxPQ stands for priority queue, which is a collection of \"Key\" objects that can be compar

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 08:56

    There is no implements in generics. The second code is invalid. You probably confusing with :

    public class MaxPQ implements Comparable {
       ...
    }
    

提交回复
热议问题