Thursday, February 12, 2026
HomeLanguagesJavaModifiers fieldModifiers() method in Java with Examples

Modifiers fieldModifiers() method in Java with Examples

The fieldModifiers() method of java.lang.reflect.Modifier class is used to get an integer value together with the modifiers of source language that can be applied to a field.

Syntax:

public static boolean fieldModifiers()

Parameters: This method accepts nothing.

Return: This method returns an int value OR-ing together the source language modifiers that can be applied to a field.
.

Below programs illustrate fieldModifiers() method:
Program 1:




// Java program to illustrate
// fieldModifiers() method
  
import java.lang.reflect.*;
  
public class GFG {
  
    public static void main(String[] args)
        throws NoSuchFieldException,
               SecurityException
    {
  
        // get Modifier using fieldModifiers()
        int result = Modifier.fieldModifiers();
  
        System.out.println(
            "Field Modifiers: "
            + Modifier.toString(result));
    }
}


Output:

Field Modifiers: public protected private static final transient volatile

Program 2:




// Java program to illustrate fieldModifiers()
  
import java.lang.reflect.*;
  
public class GFG {
  
    public static void main(String[] args)
        throws NoSuchFieldException,
               SecurityException
    {
  
        // get Modifier using fieldModifiers()
        int result = Modifier.fieldModifiers();
  
        System.out.println(
            "Int Value: "
            + result);
    }
}


Output:

Int Value: 223

References: https://docs.oracle.com/javase/10/docs/api/java/lang/reflect/Modifier.html#fieldModifiers()

RELATED ARTICLES

1 COMMENT

Most Popular

Dominic
32499 POSTS0 COMMENTS
Milvus
128 POSTS0 COMMENTS
Nango Kala
6878 POSTS0 COMMENTS
Nicole Veronica
11999 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12092 POSTS0 COMMENTS
Shaida Kate Naidoo
7010 POSTS0 COMMENTS
Ted Musemwa
7248 POSTS0 COMMENTS
Thapelo Manthata
6960 POSTS0 COMMENTS
Umr Jansen
6952 POSTS0 COMMENTS