File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

return?

 
Rayt Leeop
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code:

public String toString() {
return "X=" + x + " " + "Y=" + y;
}


the result is "x=.., y=.."

How can I make xw in two lines:
x=...
y=...
Thanks
 
Christopher Nortje
Greenhorn
Posts: 16
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just add a newline (line feed) character instead of the space " " use "\n"
 
Campbell Ritchie
Sheriff
Pie
Posts: 47222
52
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better not to use \n unless you specificially require \n. You actually want line end. It would be better to use the %n tag:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic