0
public void printTile () {
    for (int x = 0; x < tile.length; x++) {
        for (int y = 0; y < tile[x].length; y++) {
            tile[x][y].toString();
            System.out.print(tile[x][y].shapeString + "\t\t\t\t");
        }
        System.out.println();
    }
}

This method prints out the tile array however when I print it out it does not line up properly as the output appears to be like this:

SQ s: 4.0 c: red                EMPTY               EMPTY               EMPTY               EMPTY               
EMPTY               EMPTY               EMPTY               EMPTY               EMPTY               
EMPTY               EMPTY               EMPTY               EMPTY               EMPTY               
EMPTY               EMPTY               EMPTY               EMPTY               EMPTY               
EMPTY               EMPTY               EMPTY               EMPTY               EMPTY   

Is there any way, where I can format and line up all the tiles properly ?

Suman Bhadra
  • 25
  • 1
  • 4
  • Well how would you do it 'by hand'? If a tile is not EMPTY, then it shouldn't have that many tabs. Sounds like an `if` statement. Or you could use `String.format()` – sleepToken Jan 30 '21 at 20:46
  • https://stackoverflow.com/questions/2745206/output-in-a-table-format-in-javas-system-out/2745239#2745239 – am233dmg Jan 30 '21 at 20:47

0 Answers0