打印2D数组-Eclipse和PowerShell Java的不同结果

问题描述

基本上,我有一个简单的应用程序,您可以插入2D数组的尺寸(x,y),它将在控制台上打印其边框。 例如,如果您插入2 2,它将打印:

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

这将在Eclipse控制台和Windows PowerShell中正确打印,但是如果我在Cygwin ou git bash上运行应用程序(使用java -jar myApp.java),则应用程序会打印:

2 2

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

我的打印方式是:

 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

有人知道这个问题可能是什么吗? 谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)