Welcome Guest | Sign in | Register
Inheritance - Discussion Page For Q.2850 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Inheritance > Questions and Answers

Q: class A{
A(){
System.out.println(1);
} }

Class B extends A{
B(){
Super();
This(10);
System.out.println(2); }
B(int x){
System.out.println(2); }}
Class C extends B {
C(){
System.out.println(3);
Super();
} }

Class Manager{
Public static void main(String args[]){
B c=new B();
} }
A. 1,2 B. 2,1
C. compile time error D. run time error

Answer and Explanation

Answer:compile time error

Explanation:
in a single constructor we can’t use both super() and this(), if you try to use then it will throw an compile time error.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.