1

Basically I have a simple App that you insert the dimensions (x,y) of your 2D array and it will print its border on the console. For example, if you insert 2 2 it will print:

----
|  |
|  |
----

This prints correctly in the Eclipse console and for example Windows PowerShell but if I run the app (using java -jar myApp.java) on Cygwin ou git bash the app prints:

2 2

----
||
||
----

The way I am printing is:

 String LINE_SEPERATOR = System.getProperty("line.separator");
 public void render() {
    StringBuilder drawnCanvas = new StringBuilder();

    for (int row = 0; row < this.canvas.length; ++row) {
        for (int col = 0; col < this.canvas[row].length; col++) {
            drawnCanvas.append(this.canvas[row][col]);              
        }
        drawnCanvas.append(LINE_SEPERATOR);
    }
    System.out.println(drawnCanvas.toString());
}

print of the actual consoles differences

Does anyone have an idea of what the problem might be? Thanks

Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
James May
  • 11
  • 3

0 Answers0