Online Java Compiler By
JavaTpoint.com
//import statements import java.lang.reflect.Method; public class ReflectMethodgetReturnTypeExample2 { public static void method1(int x , int y , double z , String str) {} //static method method1 public static void main(String... args) throws NoSuchMethodException { Method mthd = ReflectMethodgetReturnTypeExample2.class.getDeclaredMethod("method1", int.class, int.class, double.class , String.class); Class> cls= mthd.getReturnType(); System.out.println("Method Return Type::" +cls); } }
Output