如何删除 header 列末尾的 space?
how do i remove the space at at the end of the column header?
//我想知道如何去掉header列末尾的space?
public class 布尔值 {
public static void main(String[] args) {
boolean[][] a = {{true, false, false, false, false},
{true, true, false, false, false},
{true, true, true, false, false},
{true, true, true, true, false},
{true, true, true, true, true}};
for ( int j = 0; j < a.length; j++ ) {
System.out.print( j + 1 + " " );
}
System.out.println();
for ( int i = 0; i < a.length; i++ ) {
for ( int j = 0; j < a[i].length; j++ ) {
System.out.print( ( a[i][j] == true ) ? "* " : " " );
}
System.out.print( i + 1 + "\n" );
}
}
for ( int j = 0; j < a.length - 1; j++ ) {
System.out.print( j + 1 + " " );
}
System.out.print( a.length );
//我想知道如何去掉header列末尾的space?
public class 布尔值 {
public static void main(String[] args) {
boolean[][] a = {{true, false, false, false, false},
{true, true, false, false, false},
{true, true, true, false, false},
{true, true, true, true, false},
{true, true, true, true, true}};
for ( int j = 0; j < a.length; j++ ) {
System.out.print( j + 1 + " " );
}
System.out.println();
for ( int i = 0; i < a.length; i++ ) {
for ( int j = 0; j < a[i].length; j++ ) {
System.out.print( ( a[i][j] == true ) ? "* " : " " );
}
System.out.print( i + 1 + "\n" );
}
}
for ( int j = 0; j < a.length - 1; j++ ) {
System.out.print( j + 1 + " " );
}
System.out.print( a.length );