package com.logicbig.example.clazz;
import java.lang.reflect.Modifier;
public class GetModifiersExample2 {
public static void main(String... args) {
Class<MyInterface> c = MyInterface.class;
int m = c.getModifiers();
String s = Modifier.toString(m);
System.out.println(s);
}
private static interface MyInterface {}
}
Output
private abstract static interface
For arrays the modifiers are the same as of its component type.
package com.logicbig.example.clazz;
import java.lang.reflect.Modifier;
public class GetModifiersExample3 {
public static void main(String... args) {
Class<MyClass[]> c = MyClass[].class;
int m = c.getModifiers();
String s = Modifier.toString(m);
System.out.println(s);
}
private static class MyClass {}
}
Output
private abstract final