Online Java Compiler By
JavaTpoint.com
//import statements import java.lang.reflect.Method; public class ReflectMethodgetNameExample2 { public void Test() {} public static void main(String... args) throws NoSuchMethodException { Method mthd = ReflectMethodgetNameExample2.class.getDeclaredMethod("Test"); String name = mthd.getName(); System.out.println("Method name:: " +name); } }
Output