File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "return? " Watch "return? " New topic


Rayt Leeop

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:
Christopher Nortje

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

Joined: Oct 13, 2005
Posts: 43399
Better not to use \n unless you specificially require \n. You actually want line end. It would be better to use the %n tag:
I agree. Here's the link:
subject: return?
It's not a secret anymore!