Forums Register Login

return?

+Pie Number of slices to send: Send
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
1
+Pie Number of slices to send: Send
Just add a newline (line feed) character instead of the space " " use "\n"
1
+Pie Number of slices to send: Send
Better not to use \n unless you specificially require \n. You actually want line end. It would be better to use the %n tag:
New rule: no elephants at the chess tournament. Tiny ads are still okay.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 753 times.
Similar Threads
equals()
Operator precedence
question on iteration
Java Increment Operator pre/post fix
Rounding up function
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:15:04.