Java Reflection Java Java API
java.lang.reflect.Method
public abstract int getModifiers()
Returns the modifiers for the method.
package com.logicbig.example.method;import java.lang.reflect.Method;import java.lang.reflect.Modifier;public class GetModifiersExample { private static class Processor { protected void process() {} } public static void main(String... args) throws NoSuchMethodException { Method m = Processor.class.getDeclaredMethod("process"); int modifiers = m.getModifiers(); System.out.println(modifiers); String s = Modifier.toString(modifiers); System.out.println(s); }}
4protected