Forums Register Login

Question ID :997046238320

+Pie Number of slices to send: Send
Question ID :997046238320
Which of the following are correct JSP expressions?
why "<%=System.out.println(new Date())%>" is not correct answer.It will be "out.println(System.out.println(new Date()))".
Am I right?
+Pie Number of slices to send: Send
Hello Win,
For expression in JSP page,it need an String object.Here,
System.out.println(new Date()) itself is not a String.So it
produces error.If I am wrong,please correct me.
ruijin yang
+Pie Number of slices to send: Send
 

Originally posted by ruijin yang:
Hello Win,
For expression in JSP page,it need an String object.Here,
System.out.println(new Date()) itself is not a String.So it
produces error.If I am wrong,please correct me.
ruijin yang


I think it will call "(new Date()).toSting()" method implicitly. Maybe the problem is out.println(Nov.23th 2:0pm) if "(new Date()).toSting()" =Nov.23th 2:0pm. Just guess.
+Pie Number of slices to send: Send
 

Originally posted by Win Yu:
I think it will call "(new Date()).toSting()" method implicitly.


I think you misunderstood. The problem is that the return value from the System.out call is not a String (it outputs a string on System.out, but that's not the same thing).
+Pie Number of slices to send: Send
 

Originally posted by Tim Duncan:
I think you misunderstood. The problem is that the return value from the System.out call is not a String (it outputs a string on System.out, but that's not the same thing).


OK I tried it. I got error:" Incompatible type for method. Can't convert void to java.lang.Object." The best way to understand is to try it. Thanks Duncan.

[This message has been edited by Win Yu (edited November 21, 2001).]
A tiny monkey bit me and I got tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 623 times.
Similar Threads
Current date and time
Timezone Issues
cannot find my entity bean
Garbage Collection
Change Timezone from GMT to EST, the best way to accomplish?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:38:34.