Java Reflection - Java TypeVariable.getBounds()








Syntax

TypeVariable.getBounds() has the following syntax.

Type [] getBounds()

Example

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

import java.lang.reflect.TypeVariable;
import java.util.List;
/*from  w  ww. j a v a2s  . co m*/
public class Main {
  public static void main(String args[]) throws Exception {

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

  }
}

The code above generates the following result.