Programming in Java

Casual Mode - Take your time!

1 / 10
Correct
0
Incorrect
0
Score
0%
Multiple Choice

What is the output of the following program?
import java.io.*;
class sample3
{
int a;
int b;
sample3()
{
a=0;
b=0;
}
sample3(int b1,int c1)
{
a=b1; b=c1;
}
final void print()
{
System.out.print(a);
System.out.print(b);
}
}
class sample31 extends sample3
{
int c;
sample31()
{
c=0;
}
sample31(int c)
{
this.c=c; super(4,5);
}
public static void main(String args[])
{
sample3 ob1=new sample3(4,5);
sample31 ob=new sample31();
System.out.print(ob.a);
System.out.print(ob.b);
System.out.print(ob.c);
sample31 ob2=new sample31(5);
System.out.print(ob2.a);
System.out.print(ob2.b);
System.out.print(ob2.c);
}

  1. Cannot call super class constructor
    Call to the super must be first in the constructor.
  2. 000455
  3. 000005
  4. 000450
  5. 000000
Change Mode