Test: Computer Science

Consider the following code:

char[] values = {'I',' ','l','o','v','e',' ','y','o','u','!','!'};

String s = "";

for(int i = 0; i < values.length / 2; i++) {

    char temp = values[i];

    values[i] = values[values.length - i-1];

    values[values.length - i-1] = temp;

}

for(int i = 0; i < values.length; i++) {

    s += values[i];

}

System.out.println(s);

1.

What is the output for the code above?

!you I love!

None of the others

!uyeolI!o vl

!!uoy evol I

!!you love I

1/4 questions

0%
Learning Tools by Varsity Tutors