What is the output of the following when run as java unix.Main A B?
package unix; import java.util.*; public class Main { public static void main(String[] args) { Arrays.sort(args); String result = Arrays.binarySearch(args, args[0]); System.out.println(result); } }
C.
Binary search returns an int representing the index of a match or where a match would be.
An int cannot be stored in a String variable.
The code does not compile and the answer is Option C.