• 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

HFS..pg.420

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the HFS book..the 7th question....Is the "C" option true??
If its true ...will it take the fifth key's value ..??
I don't understand..pls reply..
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I think it's true, that means foo has an entry which is String type, and the string value is "5",so it is OK.
 
Deepa Korecherla
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think its not true....but still can anyone tell...??
It will work if foo is of type List but not Map...can anyone reply??
 
Deepa Korecherla
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anybody reply..with some explanation??
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree ${foo["5"]} and $foo.[5] should be equivalent in List . Assume Map have a key which is of type String "5" then it may make a difference. but surely this is a confusing question . Better Author tell what was in there head.
 
author
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

Option C of question 7 is correct. If 'foo' is a Map, then the argument to the map is some object (here the string "5") that acts as the key into the map.

However, this syntax will also work for lists because EL will convert the string "5" into the integer 5 at runtime to find the index into the list.

Here is a small code example that demonstrates these two use cases.


What do you think the result would be?

Cheers,
Bryan
[ February 22, 2005: Message edited by: Bryan Basham ]
 
Ranjit Jana
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bryan,

This makes things clear.

I take this opportunity to compliment you for bringing out "HF servlets and JSP". No doubt your sleepless nights for bringing this book out have saved huge volume of midnight oil(at least for me).

:-)

Regards,
Ranajit Jana
 
Everybody! Do the Funky Monkey! Like this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic