Java-打印2D數(shù)組的最佳方法?我想知道打印2D數(shù)組的最佳方法是什么。這是我有的一些代碼,我只是想知道這是否是一個(gè)很好的實(shí)踐。如果您發(fā)現(xiàn)任何其他錯(cuò)誤,也請(qǐng)糾正我在這段代碼中所犯的錯(cuò)誤。謝謝!int rows = 5;int columns = 3;int[][] array = new int[rows][columns];for(int i = 0; i<rows; i++)
for(int j = 0; j<columns; j++)
array[i][j] = 0;for(int i = 0; i<rows; i++){
for(int j = 0; j<columns; j++)
{
System.out.print(array[i][j]);
}
System.out.println();}
Java-打印2D數(shù)組的最佳方法?
達(dá)令說(shuō)
2019-07-25 14:14:57