Java Reflection - Java TypeVariable.getName()








Syntax

TypeVariable.getName() has the following syntax.

String getName()

Example

In the following code shows how to use TypeVariable.getName() method.

//from  www .  j a  v a 2  s .c om
import java.lang.reflect.TypeVariable;
import java.util.List;

public class Main {
  public static void main(String args[]) throws Exception {

    TypeVariable[] tv = List.class.getTypeParameters();
    System.out.println(tv[0].getName()); 

  }
}

The code above generates the following result.