Originally posted by liqiang yang:
<%
request.setAttribute("Two","2");
Integer One = new Integer(1);
%>
${One + 1}
${Two}
${Two + 1}
The answer is: 123
I can't understand it. Can anybody figure it out? Thanks alot.
Well,
1)One is evaluated to null so null + 1 is 1 (I am not sure ,sorry)
2)Two is
String and evaluated to primitive (if you put "rft" instead of
"2" you will get big fat exception)
3)Two("2") is evaluated to 2 and 2+1 = 3
As to 'One',I am not sure so other ranchers will take care of it
best regards,
omi
[ May 14, 2008: Message edited by: omi sharma ]