This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
Question 46) Which of the following statements are true? 1) A method cannot be overloaded to be less public in a child class 2) To be overridden a method must have the same name and parameter types 3) To be overridden a method must have the same name, parameter and return types 4) An overridden method must have the same name, parameter names and parameter types Answer 3. Answer 2 is technically a correct statement right? It doesn't say that "it ONLY needs to have same name and parameter types"
Hi John, In these types of questions, you're supposed to choose the best, or most accurate, option, since you're only asked for a single answer. Option (3) is the most accurate, therefore is the correct answer. Granted, the option is possibly correct, but an identical return type is required for an overriden method, and option (3) fits the bill. Hope this helps, Paul Villangca
Joined: Jul 26, 2002
The question asks which of the following statementS are true. Meaning it could be more than one. I think the answer should be 2 and 3.
Joined: Jun 04, 2002
Oops! My bad. The answer can be 2. In any case, you shouldn't worry about these types of questions appearing on the exam itself, since the number of correct answers are specified. Thanks, Paul
Many thanks for he feedback, I have updated that question to the word "only" in option 2. I am trying to work the ambiguity out of my questions, which is a surprisingly hard thing to do but it is made much easier with feedback and discussion from others. Thanks again. Marcus