Modifiers interfaceModifiers() method in Java with Examples
Last Updated :
24 Sep, 2019
The interfaceModifiers() 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 an interface.
Syntax:
public static boolean interfaceModifiers()
Parameters: This method accepts nothing.
Return: This method returns an int value OR-ing together the source language modifiers that can be applied to an interface.
Below programs illustrate interfaceModifiers() method:
Program 1:
import java.lang.reflect.*;
public class GFG {
public static void main(String[] args)
throws NoSuchFieldException,
SecurityException
{
int result = Modifier.interfaceModifiers();
System.out.println( "Interface Modifiers: "
+ Modifier.toString(result));
}
}
|
Output:
Interface Modifiers: public protected private abstract static strictfp
Program 2:
import java.lang.reflect.*;
public class GFG {
public static void main(String[] args)
throws NoSuchFieldException,
SecurityException
{
int result
= Modifier.interfaceModifiers();
System.out.println( "Int Value: "
+ result);
}
}
|
References: https://docs.oracle.com/javase/10/docs/api/java/lang/reflect/Modifier.html#interfaceModifiers()
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...