Skip to content

Commit a5430e8

Browse files
authored
Update 04_Array_Creation.md
1 parent 7cfa8d2 commit a5430e8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ch06/04_Array_Creation.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ nums[2] = 3.14; // 数组存储异常
2626
import java.util.*;
2727
class Annoying {
2828
public static <T> T[] toArray(Collection<T> c) {
29-
T[] a = new T[c.size()]; // 编译错误
30-
int i=0; for (T x : c) a[i++] = x;
31-
return a;
29+
T[] a = new T[c.size()]; // 编译错误
30+
int i=0; for (T x : c) a[i++] = x;
31+
return a;
32+
}
3233
}
33-
}
3434
```
3535

3636
这是一个错误,因为类型变量不是可确定类型。 尝试编译此代码会报告一个通用数组创建错误:

0 commit comments

Comments
 (0)