Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JspWriter question  RSS feed

 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How are the methods print(String) and write(String) are different on this class?
Thanks,
Aruna.
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear aruna,
write(String) method is of java.io.Writer class which is extended by JspWriter class, who(JspWriter) is abstract in nature.
So the write(String) method comes through that channel, where as print(String) is a method of JspWriter class.
=> The Print(String) method in API has written following statements:
the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the Writer.write(int) method.

So, It is obvious that, Methods do not hv technical difference between them, but the important part plays by print(String) method is while converting to platform's default character encoding.
Hope i m clear enough,
Best regards, Dharmin
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!