Field getModifiers() method in Java with Examples Last Updated : 30 May, 2022 Comments Improve Suggest changes Like Article Like Report The getModifiers () method of java.lang.reflect.Field used to return the modifiers used for the field object as time of declaration, as an integer. The Modifier class should be used to decode the modifiers. Syntax: public int getModifiers() Parameters: This method accepts nothing. Return: This method returns the Java language modifiers for the underlying member. Below programs illustrate getModifiers () method: Program 1: Java // Java program to illustrate // getModifiers () method import java.lang.reflect.Field; import java.lang.reflect.Modifier; public class GFG { // initialize field private static int number; public static void main(String[] args) throws NoSuchFieldException { // get Field object Field field = GFG.class .getDeclaredField("number"); // apply getModifiers() method int modifiers = field.getModifiers(); // print the results System.out.println( Modifier .toString(modifiers)); } } Output:private static Program 2: Java // Java program to illustrate // getModifiers () method import java.lang.reflect.Field; import java.lang.reflect.Modifier; public class GFG { // initialize field final static String value = "Geeks"; public static void main(String[] args) throws NoSuchFieldException { // get Field object Field field = GFG.class .getDeclaredField("value"); // apply getModifiers() method int modifiers = field.getModifiers(); // print the results System.out.println( Modifier .toString(modifiers)); } } Output:static final References: https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Field.html#getModifiers-- Comment More infoAdvertise with us Next Article Field getName() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java-lang-reflect-package Java-Field Practice Tags : Java Similar Reads Field getName() method in Java with Examples The getName() method of java.lang.reflect.Field used to get the name of the field represented by this Field object. When a class contains a field and we want to get the name of that field then we can use this method to return the name of Field. Syntax: public String getName() Parameters: This method 3 min read Field getName() method in Java with Examples The getName() method of java.lang.reflect.Field used to get the name of the field represented by this Field object. When a class contains a field and we want to get the name of that field then we can use this method to return the name of Field. Syntax: public String getName() Parameters: This method 3 min read Field get() method in Java with Examples The get() method of java.lang.reflect.Field used to get the value of the field object. If Field has a primitive type then the value of the field is automatically wrapped in an object. If the field is a static field, the argument of obj is ignored; it may be null Otherwise, the underlying field is an 3 min read Class getModifiers() method in Java with Examples The getModifiers() method of java.lang.Class class is used to get the Java language modifiers of this class. The method returns an integer representing the encoded modifiers of this class. Syntax: public int getModifiers() Parameter: This method does not accept any parameter.Return Value: This metho 2 min read Class getModifiers() method in Java with Examples The getModifiers() method of java.lang.Class class is used to get the Java language modifiers of this class. The method returns an integer representing the encoded modifiers of this class. Syntax: public int getModifiers() Parameter: This method does not accept any parameter.Return Value: This metho 2 min read 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 va 1 min read Like