Given:
public class MarkList { | |
int num; | |
public static void graceMarks(MarkList obj4) { | |
obj4.num += 10; | |
} | |
public static void main(String[] args) { | |
MarkList obj1 = new MarkList(); | |
MarkList obj2 = obj1; | |
MarkList obj3 = null; | |
obj2.num = 60; | |
graceMarks(obj2); | |
} | |
} |
How many objects are created in the memory runtime?
A. 1
B. 2
C. 3
D. 4
題解
僅在第10行有用new運算子實體化出一個MarkList物件。