Why won't this println command start a new line?
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-03-24T17:52:05Z
Indexed on
2010/03/24
18:03 UTC
Read the original article
Hit count: 314
Here's the relevant code:
public static void printBoarders (Territory x)
{
int t = 0 ;
int n = 0 ;
for (int i = 0; i<x.borders.length; i++)
{
if (x.borders[i] == -1)
t = i ;
}
for (int j = 0; j<x.borders.length; j++)
{
if (x.borders[j] == 1)
n++ ;
}
Territory.translate (t) ;
System.out.print (" has " + n + " borders: ") ;
Territory.translate (x.borders) ;
System.out.println (" ") ;
}
When I run this, I get everything on one line without a line break. Why isn't the System.out.println (" ") ;
creating a line break?
Here is an example of what the output winds up being:
Northwest Territory, Alberta, Kamchatka, hidavid-names-macbook-pro:~ davidname$
EDIT: the problem was that this method was never being invoked. A different one which i was replacing was. All is well.
© Stack Overflow or respective owner