Interview Question
Qus: What is the output of the following Java program? 1. public class Test 2. { 3. Test(int a, int b) 4. { 5. System.out.println("a = "+a+" b = "+b); 6. } 7. Test(int a, float b) 8. { 9. System.out.println(
Answers (1)
a = 10 b = 15
Here, the data type of the variables a and b, i.e., byte gets promoted to int, and the first parameterized constructor with the two integer parameters is called.