• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

return?

 
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
Sheriff
Posts: 48382
56
  • 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