如何使用字符打印锯齿状数组?

时间:2016-05-05 13:15:27

标签: java

public static void main(String [] args) {
char[][]tictactoe= {{'#','#'},{'#','#','#','#','#'},{'#','#','#','#'}};
System.out.println(tictactoe);
}

我们希望它使用2d数组打印#符号我做错了什么

2 个答案:

答案 0 :(得分:0)

这样做:

Select a.col1
     , a.col2
     , a.col3
from a
left
join b on a.col3=b.col3 and a.col4 = b.col4 and b.col5 = -- filter cindition
left
join c on c.col3 = b.col3 and c.col4 = b.col4 and c.col5 = filter condition and c.col6 = -- extra conditions

答案 1 :(得分:0)

您必须使用循环:

char[][]tictactoe= {{'#','#'},{'#','#','#','#','#'},{'#','#','#','#'}};

StringJoiner sj = new StringJoiner(", ", "[", "]");
for(char[] arr : tictactoe)
    sj.add(Arrays.toString(arr));
System.out.println(sj.toString());

输出:

[[#, #], [#, #, #, #, #], [#, #, #, #]]