File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Mock Exam Errata and the fly likes Marcus Mock Exam No: 3 question 46 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Marcus Mock Exam No: 3 question 46" Watch "Marcus Mock Exam No: 3 question 46" New topic

Marcus Mock Exam No: 3 question 46

sreelakshmi sarma
Ranch Hand

Joined: Mar 02, 2000
Posts: 130
Which of the following statements are true?
1) A method cannot be overloaded to be less public in a child class
2) To be overriden a method must have the same name and parameter types
3) To be overriden a method must have the same name, parameter and return types
4) An overriden method must have the same name, parameter names and parameter types
I thought 2&3 are correct. But the answer given is only 3. Why not 2??
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
2) is not true because the return type of the overriden method must be the same type as the overriding method, it only says about the name and the parameter types and not the return type. So you cannot consider this option. This has to be considered when you are overriding a method.
Hope this helps!
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Sree- you are correct. I think that Marcus was thinking that #2 meant that the return type does not have to be the same for an overridden method. Which would be false. But that's not what it says, and 2 is true as written. I'm moving this to Mock Exam Errata.

"I'm not back." - Bill Harding, Twister
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Note that other requirements for overriding are that the overriding method cannot be more private, and it cannot throw checked exceptions unless they were declared in the overridden method. Neither 2 nor 3 mention these requirements - does that mean they're both wrong? No, it means that neither one is a complete list of requirements. But neither one claimed to be complete. The requirements that are listed in 2 and 3 are all correct, and so both answers are correct.
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
It says Which of the foll. are true? . Both 2) and 3) are individually correct. If it would have asked 'select the MORE SUITABLE ans from this list' then only 3) will be correct I think. One more point about the Overriding is the no & type & order of parameters of the overriding method also MUST be SAME that of the overridden one.
maha anna

[This message has been edited by maha anna (edited April 05, 2000).]
Marcus Green
arch rival

Joined: Sep 14, 1999
Posts: 2813
I think option 2 taken on its own is true (ie my answer is incorrect) . Overriding does involve more than those requirments but if you do not meet those requirements then you cannot have overriding. Don't forget I always try to include both an answer and explanation (sometimes wildly incorrect of course), so check that out when you wonder what I was thinking of.
I appreciate all comments on my questions and am interested in ambiguities as well as plain incorrect stuff.
I am still building (and correcting exam 3) and I have a few more questions on my hard disk at home that will appear real soon now.

SCWCD: Online Course, 50,000+ words and 200+ questions
I agree. Here's the link:
subject: Marcus Mock Exam No: 3 question 46
It's not a secret anymore!