In question 10 (Page 162 ) why is 'C' not a valid answer. I thought everything in inherited from Object. So why Object won't be a valid return type. Thanks for any help in advance.
The question seems to be asking for legal overloading and overriding. C is not a legal overload because the argument did not change. In addition, it's not a legal override because the return type is not a subclass of the return type of the method being overriden.
Originally posted by Debolina Ray: In question 10 (Page 162 ) why is 'C' not a valid answer. I thought everything in inherited from Object. So why Object won't be a valid return type. Thanks for any help in advance.
Hi! I don't understand why C isn't a valid answer. As I understand it, A is a valid answer since SCJP is-a Programmer. But every class is-a Object so why isn't C a correct anser? The question is question 10 page 162 in K&Bs book SCJP 5 study book. Could someone explain, im sure it isn't very difficult but I don't understand.
also, please remember not everyone has, or has easy access to, the book. It's legal to post the full question, as long as you cite the source. many folks will look at this and say "well, i'd LIKE to help, but since I have no idea what the questions says, i'll just move along to something else."
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
subject: doubt about question 10 in chapter 2 in K&B