Oracle
1Z0-808 · Question #58
1Z0-808 Question #58: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-808 to reveal the answer and full explanation for question #58. The question stem and answer options stay visible for context.
Using Loop Constructs
Question
Given the code fragment:
- public static void main(String[] args) {
- int x = 5;
- while (isAvailable(x)) {
- System.out.print(x);
- }
- }
- public static boolean isAvailable(int x) {
- return x-- > 0 ? true : false;
- }
Options
- AReplace line 6 with System. out. print (-x);
- BAt line 7, insert x --;
- CReplace line 6 with --x; and, at line 7, insert System. out. print (x);
- DReplace line 12 With return (x > 0) ? false: true;
Unlock 1Z0-808 to see the answer
You've previewed enough free 1Z0-808 questions. Unlock 1Z0-808 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Post-decrement operator#Method parameters#While loop#Loop termination