Unit 7: Lesson 5 - Fast Start
Assuming all variables are declared correctly, which of the following code segments correctly swaps the values x and y? I.x = y;y = x; II.int tmp = x;y = x;x = tmp; III.int tmp = x;x = y;y = tmp;
III only
Which of the following can be used to initialize a variable of the Integer class type? Select all that apply.
Integer a = new Integer(3); Integer a = 3;
Consider the following code: public boolean mystery(int[] a) {boolean flag = true;for (int i = 1; i < a.length; i++) {if (a[i] < a[i - 1]) {flag = false;break;}}return flag;} What does mystery(int[]) do?
Tests if the array is in ascending order.