Analyze the following code.
public class Test {
public static void main(String[] args) {
| System.out.println(max(1, 2)); |
}
public static double max(int num1, double num2) {
| System.out.println("max(int, double) is invoked"); |
}
public static double max(double num1, int num2) {
| System.out.println("max(double, int) is invoked"); |
}
}
◦ The program runs and prints "max(int, double) is invoked" followed by 2.
◦ The program runs and prints 2 followed by "max(double, int)" is invoked.
◦ The program cannot compile because the compiler cannot determine which max method should be invoked.
◦ The program cannot compile because you cannot have the print statement in a non-void method.
◦ The program runs and prints 2 followed by "max(int, double)" is invoked.