This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Enthuware 1ZO-894 question - confused Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Enthuware 1ZO-894 question - confused" Watch "Enthuware 1ZO-894 question - confused" New topic
Author

Enthuware 1ZO-894 question - confused

Paul Statham
Ranch Hand

Joined: Dec 05, 2008
Posts: 40
Edit: Ignore, it was me being stupid


So the question says


Given:

<%
Map m = new HashMap();
m.put("m", "n");
m.put("n", "o");
m.put("o", "p");
pageContext.setAttribute("map", m, PageContext.PAGE_SCOPE);
%>

Which of the following will output p? (choose 2)

A. ${map.(map.n)}
B. ${map[map[n]]}
C. ${map.o}
D. ${map(map(n))}
E. ${map.map.n}
F. ${map["o"]}


Answers are C+F, I'm confused by C.

The . operator is reserved for attributes and java beans, yes map is an attribute but it references a map object?
Trieu Duong Nguyen
Greenhorn

Joined: Nov 24, 2010
Posts: 18

Hi

I can analyze the C and F answers for you as following:

C. ${map.o} Correct

After the . "Dot" operator, it can be followed by map key or bean property.
And in [] , It can be followed by [same as dot] and index of collection or Array



Trieu Duong Nguyen
SCJP 6 | SCWCD 6
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Enthuware 1ZO-894 question - confused