Java Reflection class get modifiers

Description

Java Reflection class get modifiers

import java.lang.reflect.Modifier;

public class Main {  
  public static void main(String args[]) throws Exception {      
    Class<?> c = Class.forName("java.lang.String");  
    System.out.println(Modifier.toString(c.getModifiers()));         
    //  ww w . j a va2  s  . c o  m
    c = String.class;
    System.out.println(Modifier.toString(c.getModifiers()));         
    
    c = Thread.class;
    System.out.println(Modifier.toString(c.getModifiers()));       
    
    c = java.util.Date.class;
    System.out.println(Modifier.toString(c.getModifiers()));       
    
    c = java.sql.Date.class;
    System.out.println(Modifier.toString(c.getModifiers()));       
  }  
} 



PreviousNext

Related