• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ Chapter 7 Page 339

 
Suhas Wadadekar
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The explanation to Question 10 on Page 339 says,
'Options C and D are missing the "out" implicit object'

This implies options C and D would have been correct, if they had used the "out" implicit objects to call the println() methods. But only option C would be correct then and not D.

Though it correctly says options C and D are not correct, the same logic does not apply to both. The stated logic applied to C and option D is just totally wrong.

Can someone confirm/ contradict/ correct me?

Thanks,
Suhas
 
Ankit Garg
Sheriff
Posts: 9577
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suhas, not everyone has the HFSJ book every time with them. So when you ask a question, try to post the question or part of the question. These are the options C and D


Did you try to put option D in a JSP page after using the out implicit variable to call println, it should compile then without any problems...
 
Suhas Wadadekar
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ankit,

Thanks for posting the reply. I was late in responding because I wanted to be sure I did not misunderstand the question. I think I did not.

The question says "first" and "last" are request attributes. So even if placing 'out' before 'println()' statements in option D would be syntactically correct, it is still logically wrong as application.getInitParameter() gets you the context parameters and not the request parameters.

For retrieving request parameters, we need to use request object and thus option D would continue to be a wrong choice after using the implicit object 'out'.

Let me know.

Thanks,
Suhas.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This implies options C and D would have been correct

Not necessarily. At the exam, all you need to look for is one wrong thing. Here, "out" is missing, which is enough to say that these answers are wrong.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic