• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic