This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes question from SCWCD mock test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "question from SCWCD mock test" Watch "question from SCWCD mock test" New topic
Author

question from SCWCD mock test

shivam singhal
Ranch Hand

Joined: Jul 15, 2012
Posts: 194

<html>
<body>
Result is ${"2" > 3}
</body>
</html>


a. Result is true
b. Result is false


correct ans is :: b

how can we compare a string literal with a number??
can EL automatically convert string into number??
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 923
    
    1

hi ,

yes el treates "2" as integer for the comparison. you should keep few things in mind when you come across such questions

1. EL is not java.

2 el is forgiving. it will coerce the operands to fit into the context of operators.

there are vastly different number of combinations of such expressions possible in EL . the best way to do is to make a small program and play with such expressions. cook your own expression , see the results and then analyse it.

regards
Gurpreet


OCPJP 6(100 %) OCEWCD 6(91 %) OCPJBCD(93%)
shivam singhal
Ranch Hand

Joined: Jul 15, 2012
Posts: 194

thanks gurpeet ..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question from SCWCD mock test
 
Similar Threads
Niko's exam doubt
EL Query
display data on first jsp on start of application
print value outside while loop
Cannot forward after response has been committed