Online Java Compiler By
JavaTpoint.com
//import statement import java.lang.reflect.Method; public class ReflectMethodgetReturnTypeExample1 { public static void proc(int i, String s, String... args) {} //static method proc public static void main(String... args) throws NoSuchMethodException { //main method Method mthd = ReflectMethodgetReturnTypeExample1.class.getDeclaredMethod("proc", int.class, String.class, String[].class); Class> cls= mthd.getReturnType(); System.out.println("Return Type:: " +cls); } }
Output