1Z0-803 · Question #238
Given: class MarksOutOfBoundsException extends IndexOutOfBoundsException { } public class GradingProcess { void verify(int marks) throws IndexOutOfBoundsException { if (marks > 100) { throw new MarksO
The correct answer is C. Class MarketOutOfBoundsException. The value 104 will cause aMarketOutOfBoundsException
Question
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?
Options
- APass
- BFail
- CClass MarketOutOfBoundsException
- DClass IndexOutOfBoundsException
- EClass Exception
How the community answered
(42 responses)- A5% (2)
- B12% (5)
- C57% (24)
- D21% (9)
- E5% (2)
Explanation
The value 104 will cause aMarketOutOfBoundsException
Topics
Community Discussion
No community discussion yet for this question.