< T延伸意味着什么?

< T延伸意味着什么?

问题描述:



I have seen a method like shown below:

protected <T extends ABC> T save( T Acd, boolean en) {

它有什么作用?什么是在Java中调用的这些类型的方法声明?

What does it do? What is these type of method declarations called in Java?

它被称为泛型方法。这个整体概念在Java中被称为泛型。该声明意味着T可以是ABC的任何类型。

It is called a generic method. This whole concept is called "Generics" in Java. That declaration means T can be any type that is subclass of ABC.