Java Class getModifiers() Method

The getModifiers() method of java Class class returns the Java language modifiers for this class or interface. The modifiers contain the Java Virtual Machine's constants for the public, protected, private, final, static, abstract and interface.

Syntax

Parameter

NA

Returns

The integer representing the modifiers for this class.

Throws

Does not throw an exception.

Example 1

Test it Now

Output:

Class Modifier = public

Example 2

Test it Now

Output:

Sample1 Constructor calling
Class ClassgetModifiersExample2 Modifier = public
Class Sample1 Modifier =

Next TopicJava Class




Latest Courses