What will happen if you try to compile and run above program?
.a It will compile successfully. It will output "Created Parent" and then "Creating child"
b. It will compile successfully. It will output "Creating child" and then "Created Parent"
c. It will not compile giving warning, "Explicit constructor invocation must be first statement in constructor."
d. It will not compile giving warning, "Expression is not a valid block statement."
Answers are c and d.I know c is the correct answer and what is the meaning of option d.i don't get the meaning? please help on this. Line 1 and line2 will give compile error since Superclass didn't have no-arg constructor.But which Expression is not a valid block statement.
If you compile this, you will find only option (c) is the correct answer. Also you get following errors , but that is not mentioned in any options. This error is because of absence of a no argument constructor for parent & the fact that child constructor does not calls the super constructor with arguments
cannot find symbol symbol : constructor Parent() location: class Parent [ March 09, 2007: Message edited by: Bunty Naagar ]