mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-16 12:11:21 +08:00
doc: Update java.md (#930)
✏️ 为 Arrays.deepToString(Object[] a) 添加说明注释 🐛 修正变量名拼写错误
This commit is contained in:
16
docs/java.md
16
docs/java.md
@ -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
|
||||
|
Reference in New Issue
Block a user