Java Reflection - Java Modifier.toString(int mod)








Syntax

Modifier.toString(int mod) has the following syntax.

public static String toString(int mod)

Example

In the following code shows how to use Modifier.toString(int mod) method.

//from   w  w  w . j  av a  2  s  . c  om
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;

public class Main {
  public static void main(String... args) throws Exception {
    Class<?> c = Class.forName("java.lang.String");
    Constructor[] allConstructors = c.getDeclaredConstructors();
    for (Constructor ctor : allConstructors) {

      Modifier.toString(ctor.getModifiers());
    
    }
  }

}