• Post Reply Bookmark Topic Watch Topic
  • New Topic

return?  RSS feed

 
Rayt Leeop
Greenhorn
Posts: 23
  • 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
  • Likes 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
Marshal
Posts: 55772
163
  • Likes 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:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!