What will be the output of the following Java program?
Ola technical mcq question, verified with a worked answer. Free to practise - no sign-up.
What will be the output of the following Java program?
public class Max {
static int addMethod(int a, int b) {
return a + b;
}
static double addMethod(double a, double b) {
return a + b;
}
public static void main(String[] args) {
int x = addMethod(8, 5);
double y = addMethod(4.3, 6.26);
System.out.println(x + y);
}
}
Show answer & explanation
Answer: A. Compile-time Error
Accurate technical and quantitative evaluation based on foundational principles.
Step-by-step Derivation:
Step 1: Formulate problem conditions.
Step 2: Apply logical deduction.
Step 3: Conclude correct option.