Online Java Compiler By
JavaTpoint.com
//import statements import java.io.IOException; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.Arrays; public class ReflectMethodgetGenericExceptionTypesExample2 { private static class Processor { private void init1() {} private void process1() throws IOException {} } public static void main(String... args) throws NoSuchMethodException { Method mthd = Processor.class.getDeclaredMethod("init1"); Type[] tp = mthd.getGenericExceptionTypes(); System.out.println(Arrays.toString(tp)); Method mthd2 = Processor.class.getDeclaredMethod("process1"); Type[] tp2 = mthd2.getGenericExceptionTypes(); System.out.println(Arrays.toString(tp2)); } }
Output