| Author |
HFSJ - Web App Deployment - Question 8 (Page 613)
|
Edisandro Bessa
Ranch Hand
Joined: Jan 19, 2006
Posts: 584
|
|
Hi guys, Could you please give me some clue on this question telling why option C is NOT correct ? Which statements about <init-param> DD elements are true ? a) CORRECT - They are used to declare initialization parameters for a specific servlet. b) INCORRECT - They are used to declare initialization parameters for an entire web app. c) INCORRECT - The method that retrieves these parameters returns an Object ? I know the method this option is referring to is getInitParameter which takes and returns a String. My question is : If this method returns a String, doesn't it return an Object implicitly ? d) CORRECT - The method that retrieves these parameters takes a String.
|
"If someone asks you to do something you don't know how to, don't tell I don't know, tell I can learn instead." - Myself
|
 |
Firas Zuriekat
Ranch Hand
Joined: May 09, 2006
Posts: 143
|
|
If this method returns a String, doesn't it return an Object implicitly ?
(string instanceof (Object)) is True (object instanceof (String)) is False. So an object (an instance of Object) is not a a String. So getInitParameter() does not return object. This is because Object is neither a subtype nor an implementer of String. If it were, then we could safely say getInitParameter() returns the subtype Object. But it isn't so we can't that. [ September 10, 2006: Message edited by: Firas Zuriekat ]
|
 |
Niranjan Deshpande
Ranch Hand
Joined: Oct 16, 2005
Posts: 1277
|
|
Please refer to http://www.oreilly.com/catalog/headservletsjsp/errata/headservletsjsp.confirmed and search for page {608}. This is a printing mistake. Hope that helps
|
SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
|
 |
Edisandro Bessa
Ranch Hand
Joined: Jan 19, 2006
Posts: 584
|
|
Hum ... After read the errata you posted above everything makes sense. Thanks Niranjan for your valuable tip and Firas for your prompt reply.
|
 |
 |
|
|
subject: HFSJ - Web App Deployment - Question 8 (Page 613)
|
|
|