This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • 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: 48635
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