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 Âimportjava.lang.reflect.*; ÂpublicclassGFG { Â    publicstaticvoidmain(String[] args)        throwsNoSuchFieldException,               SecurityException    { Â        // get Modifier using fieldModifiers()        intresult = Modifier.fieldModifiers(); Â        System.out.println(            "Field Modifiers: "            + Modifier.toString(result));    }} | 
Field Modifiers: public protected private static final transient volatile
Program 2:
| // Java program to illustrate fieldModifiers() Âimportjava.lang.reflect.*; ÂpublicclassGFG { Â    publicstaticvoidmain(String[] args)        throwsNoSuchFieldException,               SecurityException    { Â        // get Modifier using fieldModifiers()        intresult = Modifier.fieldModifiers(); Â        System.out.println(            "Int Value: "            + result);    }} | 
Int Value: 223
References: https://docs.oracle.com/javase/10/docs/api/java/lang/reflect/Modifier.html#fieldModifiers()


 
                                    







