File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
Web Component Certification (SCWCD/OCPJWCD)
Doubt in EL  operator
Joined: Aug 28, 2002
Feb 17, 2007 19:44:00
List list = new ArrrayList();
What will be the value of output?
I thought that list['listIdx'] will return 0, since 'listIdx' is in quotes.(Quoted 'listIdx' is not an index of list, so the default value 0). & hence list returns 'a'.
But according to HFSJ "c" is the correct answer (Page: 428)
I think,the term inside  evaluated only if it is not in quotes.[Page 396, 7th bullet point].
Pls advice where I misunderstood. Thanks.
Regards,<br />Yasin<br />SCJP,SCWCD,SCBCD
Joined: Feb 17, 2007
Feb 21, 2007 00:33:00
list['listIdx'] will throw an exception since 'listIdx' is a
, and not an integer used to retrieve the values in the list [i.e. get(int index)]
I checked the errata of HFSJ at
and it looks like the correct option was
[ February 21, 2007: Message edited by: Hunny Lee ]
I agree. Here's the link:
subject: Doubt in EL  operator
Please tell me the correct answer
Trouble understanding evaluation of EL string literal
Ch :8 QNo: 6 Pg:420
Doubt in Question no 6 Page no 420
HFSJ - Page 428 - Q6 - option D
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015