Given the code fragment:

Given the code fragment:
public static void main(String[] args) {
int iArray[] = {65, 68, 69};
iArray[2] = iArray[0];
iArray[0] = iArray[1];
iArray[1] = iArray[2];
for (int element : iArray) {
System.out.print(element + " ");
}
A. 68, 65, 69
B. 68, 65, 65
C. 65, 68, 65
D. 65, 68, 69
E. Compilation fails

Download Printable PDF. VALID exam to help you PASS.

0 thoughts on “Given the code fragment:

  1. Option B.

    public class Test {

    public static void main(String[] args) {

    int iArray[] = { 65, 68, 69 };
    iArray[2] = iArray[0];
    iArray[0] = iArray[1];
    iArray[1] = iArray[2];
    for (int element : iArray) {
    System.out.print(element + ” “);
    }
    }
    }

    Output:
    68 65 65

Leave a Reply

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


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