Your question is Static Variables Output. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
QualityKiosk's test-execution engine uses a Counter helper to assign IDs to generated test cases, and this is a simplified version of it along with the runner that exercises it.
class Counter {
static int base = 10;
int id;
Counter() {
base += 5;
id = base;
}
static void reset() {
base = 0;
}
}
public class TestRunner {
public static void main(String[] args) {
Counter c1 = new Counter();
Counter c2 = new Counter();
Counter.reset();
Counter c3 = new Counter();
System.out.println(c1.id + " " + c2.id + " " + c3.id);
System.out.println(Counter.base);
}
}
Given this code with a static variable shared across multiple Counter instances, walk through exactly how you would determine what TestRunner.main prints, step by step, and give the final output.