内存练习 - 循环Q37 E02
从 Main 的 run 方法 开始绘制内存
在每个检查点,检查你画的内存是否跟答案一致
练习 1
1 2 3 4 5 6 7 8 9 10 11 12 public class Point { public int x; public int y; public Point() { } public Point(int x, int y) { this.x = x; this.y = y; }}
1 2 3 4 5 6 7 8 9 public class Driver { public static void main(String[] args) { Point current = null; for (int i = 0; i < 3; i++) { current = new Point(i, i); } // 检查点 }}
检查点 答案

练习 2
1 2 3 4 5 6 7 8 9 10 11 12 public class Point { public int x; public int y; public Point() { } public Point(int x, int y) { this.x = x; this.y = y; }}
1 2 3 4 5 6 7 8 9 10 public class Driver { public static void main(String[] args) { Point current = new Point(0, 0;; for (int i = 0; i < 3; i++) { current.x = i; current.y = i; } // 检查点 }}
检查点 答案
