• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Question ID :997046238320

 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Win Yu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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).
 
Win Yu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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).]
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic