This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes return? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "return? " Watch "return? " New topic
Author

return?

Rayt Leeop
Greenhorn

Joined: Jun 09, 2011
Posts: 23
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

Joined: Jul 09, 2010
Posts: 16
Just add a newline (line feed) character instead of the space " " use "\n"
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43948
    
  33
Better not to use \n unless you specificially require \n. You actually want line end. It would be better to use the %n tag:
 
Have you checked out Aspose?
 
subject: return?
 
It's not a secret anymore!