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 Errata : P-608

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
q-8 Which statements about <init-param> DD elements are true ?

In this option c) is

The method that retrieves these parameters returns an object.

According to me this option is true ( but according to book it;s not)..

The method signature is

String getInitParameter(String obj);
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some methods (like getAttribute) return type Object.

getInitParameter does not return type Object, it returns type String.

OK, String does extend Object. I see your point. But this is specifically asking about the API.

Think of it this way... if someone were to ask you in an interview what getInitParameter returns and you said Object, do you think the interviewer would say "Correct!"?
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marc..
Yes even if interviewer will ask me what getInitParameter() returns, i will say a Object because String is an object..

Moreover i think we should follow the standards else it will be too confusing is everyone starts his own interpretations..
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In an interview, if you knew the answer were String you would say String.

I believe the "standard" is to say the specific type if you are discussing API. I don't see how any API conversation would be beneficial otherwise.
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Yes even if interviewer will ask me what getInitParameter() returns, i will say a Object because String is an object.."

By that token the answer to every question about the return type of a method (that was not a primitive) would be Object. And it would make questions about method return types largely meaningless.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic