Examveda
Examveda

What is the output of the following program code?
abstract class C1{
	public C1(){ 
		System.out.print(1); 
	} 
} 
class C2 extends C1{ 
	public C2(){ 
		System.out.print(2); 
	} 
} 
class C3 extends C2{ 
	public C3(){ 
		System.out.println(3); 
	} 
} 
public class Test{ 
	public static void main(String[] a){ 
		new C3(); 
	} 
}

A. 12

B. 23

C. 123

D. 321

Answer: Option C


Join The Discussion

Comments ( 1 )

  1. Sharanu Koti
    Sharanu Koti :
    5 years ago

    how this answer came?

Related Questions on Inheritence

Which is true?

A. "X extends Y" is correct if and only if X is a class and Y is an interface

B. "X extends Y" is correct if and only if X is an interface and Y is a class

C. "X extends Y" is correct if X and Y are either both classes or both interfaces

D. "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces