Skip to content

Commit

Permalink
doc: Update java.md (#930)
Browse files Browse the repository at this point in the history
✏️ 为 Arrays.deepToString(Object[] a) 添加说明注释
🐛 修正变量名拼写错误
  • Loading branch information
giteeking authored Mar 4, 2025
1 parent d57b600 commit 792451b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,16 @@ for (int a: arr) {
### 二维数组 Multidimensional Arrays

```java
int[][] matrix = { {1, 2, 3}, {4, 5} };
int[][] matrix = {{1, 2, 3}, {4, 5}, {6}};
int x = matrix[1][0]; // 4
// [[1, 2, 3], [4, 5]]
Arrays.deepToString(matrix)
for (int i = 0; i < a.length; ++i) {
for(int j = 0; j < a[i].length; ++j) {
System.out.println(a[i][j]);
}
System.out.Println(Arrays.deepToString(matrix));
// 输出: [[1, 2, 3], [4, 5], [6]]
for (int i = 0; i < matrix.length; ++i) {
for(int j = 0; j < matrix[i].length; ++j) {
System.out.println(matrix[i][j]);
}
}
// 输出: 1 2 3 4 5 6 7
// 输出: 1 2 3 4 5 6
```

### 排序 Sort
Expand Down

0 comments on commit 792451b

Please sign in to comment.