Question: how you would attempt to debug the program. My example of Java Exception Handling is using an object of Exception class as other classes inherit
how you would attempt to debug the program. My example of Java Exception Handling is using an object of Exception class as other classes inherit the Exception class:
Example Code
class Exceptions{
public static void main(String[] args) {
String languages[] = { "C", "C++", "Java", "Perl", "Python" };
try {
for (int c = 1; c <= 5; c++) {
System.out.println(languages[c]);
}
} catch (Exception e) {
System.out.println(e);
}
}
}
Output:
C++
Java Perl
Python
java.lang.ArrayIndexOutOfBoundsException: 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
