Which modification enables the code to print 54321?

Given the code fragment:

Which modification enables the code to print 54321?
A. Replace line 6 with System, out. print (–x) ;
B. At line 1, insert x –;
C. Replace line 6 with –x; and, at line 7, insert system, out. print (x);
D. Replace line 12 With return (x > 0) ? false: true;

Download Printable PDF. VALID exam to help you PASS.

5 thoughts on “Which modification enables the code to print 54321?

  1. B
    public static void main(String[] args) {
    int x = 5;
    while (isAvailable(x)) {
    System.out.print(x);
    x–;
    }
    }
    static Boolean isAvailable(int x){
    return x–>0 ? true :false;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.