Author | Topic: Inner class Constructor |
Shiva ranch hand |
posted April 07, 2000 03:05 PM
this is a question from javaworld 1. Given the following class definition:
Ans: a) and c) IMO there is no default (no arg) constructor in class A then how come ans c) is correct? constructor in class B which is also no arg constructor will try to call default constructor in A? then why ans b) is wrong?? Maha , Jim i need your help here,
[This message has been edited by maha anna (edited April 07, 2000).]
|
maha anna bartender |
posted April 07, 2000 03:22 PM
Shiva, Please use the formating tags [ code ] [ /code] around your sample code. Or you can use the html tags < pre> < /pre> all tags without the space inside them. The ans. given are correct and your thinking is also correct. But you didn't apply it properly I think. Please read the ans carefully. ans b) is wrong because this is the one which extends class A and needs the A() in A class. Since it is not there in A, this ans is wrong. Please refer to this. I also request all to use the 'search' facility liberally at the top-right of every page. [This message has been edited by maha anna (edited April 07, 2000).]
|
Shiva ranch hand |
posted April 07, 2000 03:40 PM
thank you maha, i didnt know about those formatting tags, will use from now onwards and i think now i am clear on constructors
|
| | |