• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic