Java Modifier.isPrivate(int mod)
Syntax
Modifier.isPrivate(int mod) has the following syntax.
public static boolean isPrivate(int mod)
Example
In the following code shows how to use Modifier.isPrivate(int mod) method.
import java.lang.reflect.Modifier;
//from www. jav a 2 s . c om
public class Main {
public static void main(String[] args) throws Exception {
Class<?> clazz = String.class;
int modifier = clazz.getModifiers();
if (Modifier.isPrivate(modifier)) {
System.out.println("isPrivate");
}
}
}