Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ - Web App Deployment - Question 8 (Page 613)

 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Firas Zuriekat
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hum ...

After read the errata you posted above everything makes sense.

Thanks Niranjan for your valuable tip and Firas for your prompt reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic