Java Reflection - Java Modifier.isFinal(int mod)


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

public static boolean isFinal(int mod)


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

/* w  ww  .j  av a 2 s .c o m*/
import java.lang.reflect.Modifier;

public class Main {
  public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isFinal(modifier)) {

The code above generates the following result.