wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Autboxing & SCWCD for J2EE 5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Autboxing & SCWCD for J2EE 5" Watch "Autboxing & SCWCD for J2EE 5" New topic
Author

Autboxing & SCWCD for J2EE 5

Robert O'Leary
Ranch Hand

Joined: Mar 24, 2009
Posts: 41
In the Head First Servlet & JSP book it says:

The updated SCWCD exam is called “Sun Certified Web Component Developer for the Java
Platform, Enterprise Edition 5” (CX-310-083), but don’t get confused by the title. The updated
exam is still designed for Java EE v1.4 and for the servlet v2.4 and JSP v2.0 specifications.

Does this mean that we act as if there is no autoboxing for the sake of the exam?

So if you see a question in the exam with something like this:


It is wrong.


SCJP6
Robert O'Leary
Ranch Hand

Joined: Mar 24, 2009
Posts: 41
Can anyone confirm this for me? As later on in the Head First Book they have a contradictory statement in a question that implies boxing occurs and is part of the exam...
Bruce Phillips
Greenhorn

Joined: Nov 20, 2001
Posts: 13
This errata should answer your question:

The question reads:
Given req is a reference to a valid HttpServletRequest, and:
13. String[] s = req.getCookies();
14. Cookie[] c = req.getCookies();
15. req.setAttribute("myAttr1", "42");
16. req.setAttribute("myAttr2", 42);
17. String[] s2 = req.getAttributeNames();
18. String[] s3 = req.getParameterValues("attr");

Which lines of code will not compile? (Choose all that apply.)
A. line 13
B. line 14
C. line 15
D. line 16
E. line 17
F. line 18

The soultion says that Answer D is not correct. "-Option D: setAttribute() takes a String and an Object, and as of Java 5, 42 can be boxed to an Object."

While this may be true for Java 5, this exam does not test on Java 5 as noted on page xxviii of the book:

"About the SCWCD (for Java EE 1.5) exam
The updated SCWCD exam is called “Sun Certified Web Component Developer for the Java Platform, Enterprise Edition 5” (CX-310-083), but don’t get confused by the title. The updated exam is still designed for Java EE v1.4 and for the servlet v2.4 and JSP v2.0 specifications."

Which means autoboxing does not exist and Answer D IS correct. Line 16 will not compile.

Note from the Author or Editor:
Agreed. Drop option D and line 16 from the question here and on pg 811

see: http://oreilly.com/catalog/9780596516680/errata/
Bruce Phillips
Greenhorn

Joined: Nov 20, 2001
Posts: 13
I don't want to get into a discussion of specific questions that are on the exam (which I just took and passed) but this area of whether or not we can expect autoboxing to occur when providing a primitive value as an argument to HttpSession setAttribute method needs to be clarified further (despite my earlier post on the errata to the HFSJ book).

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Autboxing & SCWCD for J2EE 5