A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
Java in General
Joined: Jun 09, 2011
Jun 09, 2011 20:24:18
return "X=" + x + " " + "Y=" + y;
the result is "x=.., y=.."
How can I make xw in two lines:
Joined: Jul 09, 2010
Jun 09, 2011 20:50:18
Just add a newline (line feed) character instead of the space " " use "\n"
Joined: Oct 13, 2005
Jun 10, 2011 08:29:02
Better not to use \n unless you specificially require \n. You actually want line end. It would be better to use the %n tag:
return String.format("x = %d%ny = %d", x, y); // Assumes x and y are integers.
It is sorta covered in the
JavaRanch Style Guide
question on iteration
Java Increment Operator pre/post fix
Rounding up function
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015