Modifiers classModifiers() method in Java with Examples
The classModifiers() 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 class.
Syntax:
public static boolean classModifiers()
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 class.
Below programs illustrate classModifiers() method:
Program 1:
// Java program to illustrate // classModifiers() method import java.lang.reflect.*; public class GFG { public static void main(String[] args) throws NoSuchFieldException, SecurityException { // get Modifier using classModifiers() int result = Modifier.classModifiers(); System.out.println( "Modifiers: " + Modifier.toString(result)); } } |
Modifiers: public protected private abstract static final strictfp
Program 2:
// Java program to illustrate classModifiers() import java.lang.reflect.*; public class GFG { public static void main(String[] args) throws NoSuchFieldException, SecurityException { // get Modifier using classModifiers() int result = Modifier.classModifiers(); System.out.println("Int Value: " + result); } } |
Int Value: 3103
References: https://docs.oracle.com/javase/10/docs/api/java/lang/reflect/Modifier.html#classModifiers()
Recommended Posts:
- Modifiers interfaceModifiers() method in Java with Examples
- Modifiers toString() method in Java with Examples
- Modifiers constructorModifiers() method in Java with Examples
- Modifiers parameterModifiers() method in Java with Examples
- Modifiers fieldModifiers() method in Java with Examples
- Modifiers methodModifiers() method in Java with Examples
- Access Modifiers in Java
- Access and Non Access Modifiers in Java
- Java lang.Long.builtcount() method in Java with Examples
- Java lang.Long.reverse() method in Java with Examples
- Java lang.Long.numberOfLeadingZeros() method in Java with Examples
- Java lang.Long.numberOfTrailingZeros() method in Java with Examples
- Java.lang.Short toString() method in Java with Examples
- Java.util.Collections.rotate() Method in Java with Examples
- Java lang.Long.lowestOneBit() method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

