Ques 17: Given:
class One {
public One() { System.out.print(1); }
}
class Two extends One {
public Two() { System.out.print(2); }
}
class Three extends Two {
public Three() { System.out.print(3); }
}
public class Numbers{
public static void main( String[] argv ) { new Three(); }
}
What is the result when this code is executed?
A. 1
B. 3
C. 123
D. 321
E. The code runs with no output.
Answer: C
class One {
public One() { System.out.print(1); }
}
class Two extends One {
public Two() { System.out.print(2); }
}
class Three extends Two {
public Three() { System.out.print(3); }
}
public class Numbers{
public static void main( String[] argv ) { new Three(); }
}
What is the result when this code is executed?
A. 1
B. 3
C. 123
D. 321
E. The code runs with no output.
Answer: C