A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
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.
I agree. Here's the link:
question on iteration
Rounding up function
Java Increment Operator pre/post fix
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014