Online Java Compiler By
JavaTpoint.com
//import statement import java.lang.reflect.Constructor; import java.lang.reflect.Type; public class ReflectMethodgetGenericExceptionTypesExample1 { public static void main(String[] args) { Constructor[] cnstrct = DemoRClass11.class.getConstructors(); Type[] exptn = cnstrct[0].getGenericExceptionTypes(); for (int i = 0; i < exptn.length; i++) { System.out.println(exptn[i]); } } } class DemoRClass11 { private String Field; public DemoRClass11() throws ArrayIndexOutOfBoundsException { } public DemoRClass11(String sampleField){ this.Field = Field; } public String getField() { return Field; } public void setField(String sampleField) { this.Field = Field; } }
Output