Przeglądaj źródła

fix: 修正第11题MyArray测试代码中容量预期值(4→6),完善注释说明

WanJL 1 dzień temu
rodzic
commit
5434d0cd30
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      课堂练习题/20260721-构造方法练习.md

+ 1 - 1
课堂练习题/20260721-构造方法练习.md

@@ -572,7 +572,7 @@ public class MyArrayTest {
 
         // 4. 测试各个方法
         System.out.println("元素个数:" + arr.size());        // 5
-        System.out.println("当前容量:" + arr.capacity());     // 4(3*1.5=4,再扩容 4*1.5=6
+        System.out.println("当前容量:" + arr.capacity());     // 6(3→4→6,扩容了两次
         System.out.println("下标2的元素:" + arr.get(2));     // 30
         System.out.println("是否包含40:" + arr.contains(40)); // true
         System.out.println("50的下标:" + arr.indexOf(50));   // 4