What is the result of the following?
public class Main{ public static void main(String[] argv){ int[] random = { 16, -41, 112, 10, -110 }; int x = 112; int y = Arrays.binarySearch(random, x); System.out.println(y); } }
D.
The code compiles and runs fine.
We can only binary search an sorted array for a meaningful result.