Java Modifier.isProtected(int mod)

Syntax

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

public static boolean isProtected(int mod)

Example

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


import java.lang.reflect.Modifier;
//from   w  w  w.j a  va2s  . co  m
public class Main {
  public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isProtected(modifier)) {
      System.out.println("isProtected");
    }
  }
}




















Home »
  Java Tutorial »
    java.lang.reflect »




Array
Constructor
Field
Method
Modifier
ParameterizedType
TypeVariable