This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question from SCWCD mock test

 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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
Posts: 924
1
Fedora Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks gurpeet ..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic