Java Reflection class get implemented interfaces

Description

Java Reflection class get implemented interfaces

import java.lang.reflect.Type;

public class Main {  
  public static void main(String args[]) throws Exception {      
    Class<?> c = Class.forName("java.lang.String");  
    Type[] intfs = c.getGenericInterfaces();  
    System.out.println("implements: ");  
    for(Type intf : intfs)   {
      System.out.println(intf);        
    }//  w w w.j a va 2s  .c  o  m
        
    intfs = c.getInterfaces();  
    System.out.println("implements: ");  
    for(Type intf : intfs)   {
      System.out.println(intf);        
    }
  }  
} 



PreviousNext

Related