多选题 Given:
2. class Engine {
3. public class Piston {
4. static int count = 0;
5. void go() {System.out.print(" pump " + ++count); }
6. }
7. public Piston getPiston() {return new Piston(); }
8. }
9. public class Auto {
10. public static void main(String[] args) {
11. Engine e = new Engine();
12. // Engine.Piston p = e.getPiston();
13. e.Piston p = e.getPiston();
14. p.go(); p.go();
15. } }
In order for the code to compile and produce the output" pump 1 pump 2", which are true? (Choose all that apply.)
【正确答案】 B、C
【答案解析】