implements vs extends in generics in Java

前端 未结 3 2084
长发绾君心
长发绾君心 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 09:12

    I assume it was decided to use extends for both interfaces and classes, because in the case of generic class declaration it does not make any difference is type argument bound to interface or to class.

    Of course meaning of extends is quite different from its typical usage in class definition. Angelika Langer do have nice text about different meanings of extends in Java: Does "extends" always mean "inheritance"?

提交回复
热议问题