Given: What is the result?
A.
Fail
B.
Class Exception
C.
Pass
D.
Class IndexOutOfBoundsException
E.
Class MarketOutOfBoundsException
Given: What is the result?
Given: What is the result?
A.
Fail
B.
Class Exception
C.
Pass
D.
Class IndexOutOfBoundsException
E.
Class MarketOutOfBoundsException
Answer: E
Code question:
public class GradingProcess {
void verify(int marks) throws IndexOutOfBoundsException {
if (marks > 100) {
throw new MarksOutOfBoundsException();
}
if (marks > 50) {
System.out.print(“Pass”);
} else {
System.out.print(“Fail”);
}
}
public static void main(String[] args) {
int marks = Integer.parseInt(args[2]);
try {
new GradingProcess().verify(marks);
} catch(Exception e) {
System.out.println(e.getClass());
}
}
}
public class MarksOutOfBoundsException extends IndexOutOfBoundsException {
}
Output:
class MarksOutOfBoundsException