[Solved] Reflection – Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0


Based on your exception, you aren’t passing any arguments to your class’ main method –

System.out.println(Arrays.toString(args)); // <-- to display your arguments.
// Class<?> c = Class.forName(args[0]);    // <-- you should have a default
Class<?> c = Class.forName(args.length > 0 ? args[0] : "java.lang.Object");

3

solved Reflection – Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0