Java Reflection class get simple name

Description

Java Reflection class get simple name

public class Main {  
  public static void main(String args[]) throws Exception {      
    Class<?> c = Class.forName("java.lang.String");  
    System.out.println("Simple name: "+c.getSimpleName()); 
    /*from w w w.j  a  va  2 s  . co m*/
    c = String.class;
    System.out.println("Simple name: "+c.getSimpleName()); 
    
    c = int[].class;
    System.out.println("Simple name: "+c.getSimpleName()); 
    
    c = int.class;
    System.out.println("Simple name: "+c.getSimpleName()); 
    
    c = Class.class;
    System.out.println("Simple name: "+c.getSimpleName()); 
  }  
} 



PreviousNext

Related