• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Epractice Lab mock exam 3 about [] operator

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try a Set?
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, that is what I expected.

Option C is wrong because not all Collections can use the [] operator.
 
On top of spaghetti all covered in cheese, there was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic