You are on page 1of 1

{

//
}
D) All the above
Ans: C
31-What is the output of the below Java program with many constructors?
public class Constructor7
{
Constructor7(int a)
{
System.out.println("Book=" + a);
}
Constructor7(float a)
{
System.out.println("Pen="+ a );
}
public static void main(String[] args)
{
Constructor7 con = new Constructor7(50.5f);
}
}
Ans:B
32-What is the output of the below Java program with many constructors?
public class Constructor8
{
Constructor8(boolean a)
{
System.out.println("MODEM="+ a );
}
Constructor8(float a)
{
System.out.println("ROUTER=" + a);
}
public static void main(String[] args)
{
Constructor8 con1 = new Constructor8(50);
Constructor8 con2 = new Constructor8(false);
}
}
A)
ROUTER=50.0
MODEM=false
B)
ROUTER=50
MODEM=false
C) Compiler error

You might also like