Online Java Compiler By
JavaTpoint.com
import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; public class ReflectMethodgetModifierExample2 { public static void main(String[] args) { Method[] mthd = DemoX1.class.getMethods(); for (Method mthd1 : mthd) { System.out.println("Modifier Name : " + Modifier.toString(mthd1.getModifiers())); //get the modifier System.out.println("Method Name : " + mthd1.toGenericString()); } } } class DemoX1 { private String Field; public DemoX1() throws ArrayIndexOutOfBoundsException { } private DemoX1(String Field){ this.Field = Field; } public String getSampleField() { return Field; } public void setSampleField(String Field) { this.Field = Field; } }
Output