This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ Chapter 7 Page 339 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ Chapter 7 Page 339" Watch "HFSJ Chapter 7 Page 339" New topic
Author

HFSJ Chapter 7 Page 339

Suhas Wadadekar
Ranch Hand

Joined: May 16, 2006
Posts: 95
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

Joined: Aug 03, 2008
Posts: 9307
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Suhas Wadadekar
Ranch Hand

Joined: May 16, 2006
Posts: 95
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
 
 
subject: HFSJ Chapter 7 Page 339