1Z0-803 · Question #14
Given: Which two are possible outputs?
The correct answer is A. Option A D. Option D. The first println statement, System.out.println("Before if clause");, will always run. If Math.Random() > 0.5 then there is an exception. The exception message is displayed and the program terminates. If Math.Random() > 0.5 is false, then the second println statement runs as well
Question
Given:
Which two are possible outputs?
Exhibits
Options
- AOption A
- BOption B
- COption C
- DOption D
How the community answered
(33 responses)- A58% (19)
- B27% (9)
- C15% (5)
Explanation
The first println statement, System.out.println("Before if clause");, will always run. If Math.Random() > 0.5 then there is an exception. The exception message is displayed and the program terminates. If Math.Random() > 0.5 is false, then the second println statement runs as well. Incorrect answers: B: The second println statement would not run. C: The first println statement will always run.
Topics
Community Discussion
No community discussion yet for this question.

