Practice · 1 of 4
Exam MCQ
CHALLENGE
Difficulty: advanced+25 XP
What is printed? (An object AND a static are involved.)
``java
public class Gadget {
private static int made = 0;
private int id;
public Gadget() { made++; id = made * 2; }
public int getId() { return id; }
public static int total() { return made; }
}
Gadget a = new Gadget();
Gadget b = new Gadget();
Gadget c = new Gadget();
System.out.print(Gadget.total() + "," + b.getId());
`
A. 3,4
B. 2,4
C. 3,6
D. 6,4`
Print the letter, then your one-sentence justification.
Press Submit to check your solution.
Back to lesson: Practice: Exam #3: MCQ section