java.lang.reflect.Modifier.toString() Method Example



Description

The java.lang.reflect.Modifier.toString() method returns a string describing the access modifier flags in the specified modifier.

Declaration

Following is the declaration for java.lang.reflect.Modifier.toString() method.

public static String toString(int mod)

Returns

a string representation of the set of modifiers represented by mod.

Example

The following example shows the usage of java.lang.reflect.Modifier.toString() method.

package com.tutorialspoint;

import java.lang.reflect.Modifier;

public class ModifierDemo {
   public static void main(String[] args) {

      System.out.println(Modifier.toString(Modifier.toString()));
   }
}

Let us compile and run the above program, this will produce the following result −

public protected private abstract static final synchronized native strictfp
java_reflect_modifier.htm
Advertisements