Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Epractice Lab mock exam 3 about [] operator

 
Ranch Foreman
Posts: 1897
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The [] operator of JSTL is used to access which of the following.
[ Choose four ]

a. Array
b. Java Bean properties
c. Collection
d. Map
e. List

Choice A, Choice C, Choice D and Choice E are correct


The collection access operator [] can be used for accessing map, list, collection, array, properties, and Java bean objects. The property access operator '.' can only be used for accessing properties.



I think [] can be used to access Java bean properties, like ${person["name]"} (assume person is a bean and name is the property).
So, I think all of the options are correct.
 
Creator of Enthuware JWS+ V6
Posts: 3341
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure about answer C: Collection. The specs mention Maps and Lists explicitly, but not a Set.

Did you try it?
 
Himai Minh
Ranch Foreman
Posts: 1897
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Frits,

It works.

But I don't think HashSet will work. Set does not use index or key for each object in its collection.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3341
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try a Set?
 
Himai Minh
Ranch Foreman
Posts: 1897
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Frits,
this is what I tried and the exception I got:


javax.el.PropertyNotFoundException: Property 'Hibernate' not found on type java.util.HashSet
javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:259)
javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:236)
javax.el.BeanELResolver.property(BeanELResolver.java:346)
javax.el.BeanELResolver.getValue(BeanELResolver.java:95)
...

 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3341
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, that is what I expected.

Option C is wrong because not all Collections can use the [] operator.
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic