Reputation: 11
I have some method in which I want to display a sudoku grid, nothing fancy (it prints lines to the console). Here is the method:
public static void DisplaySudoku(){
System.out.println("=====================================");
for(int i = 0 ; i < 9 ; i++){
System.out.print("|");
for(int j = 0 ; j < 9 ; j++){
System.out.print(" " + String.valueOf(linesArray[i][j].charAt(2)) + " |" );
}
System.out.print("\r");
}
System.out.println("=====================================");
}
The array linesArray[][] is built somewhere else, and is actually working, stored in a member of the class (I have tested it, displaying values within the main method without any problem). But the output when compiling and running gives me only the top and bottom lines:
=====================================
=====================================
I wonder why it seems to skip everything inside the loops?
Upvotes: 0
Views: 15
Reputation: 11
Got it, the \r
returns to the beginning of the line without actually changing to a new line. Will try to work it out some other way.
Upvotes: 0