Question 186

Given:
class MarksOutOfBoundsException extends IndexOutOfBoundsException { }
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.print(e.getClass());
}
}
}
And the command line invocation:
Java grading process 89 50 104
What is the result?
  • Question 187

    Given:

    What is the result?
  • Question 188

    Given the code fragment:

    What is the result if the integer aVar is 9?
  • Question 189

    Given:

    Which code fragment can replace the if block?
  • Question 190

    Given:

    What is result?