What is the output of the following Java program no. 4 ?

  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(“a = “+a+” b = “+b);
  10.     }
  11.     public static void main (String args[])
  12.     {
  13.         byte a = 10;
  14.         byte b = 15;
  15.         Test test = new Test(a,b);
  16.     }
  17. }

The output of the following program is:

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.