Java Modifier INTERFACE
Syntax
Modifier.INTERFACE has the following syntax.
public static final int INTERFACE
Example
In the following code shows how to use Modifier.INTERFACE field.
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
/*from w ww. j a va 2 s. c o m*/
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) {
int searchMod = Modifier.INTERFACE;
int mods = accessModifiers(ctor.getModifiers());
if (searchMod == mods) {
System.out.println(ctor);
}
}
}
private static int accessModifiers(int m) {
return m & Modifier.INTERFACE;
}
}