12. private int weight;
13. public payload(int wt) { weight = wt; }
13. public void setweight(mt w) { weight = w; }
15. public string tostring { return integer.tostring(weight); }
16. }
17.
18. public class testpayload {
19. static void changepayload(payload p) {
20. /* insert code here */
21. }
22.
23. public static void main(string args) {
24. payload p = new payload();
25. p.setweight(1024);
26. changepayload(p);
27. system.out.println(」the value of p is 「+ p);
28. }
29. }
Which statement, placed at line 20, causes the code to print 「the value of p is 420.」?()
A、 p.setweight(420);
B、 p.changepayload(420);
C、 p = new payload(420);
D、 payload.setweight(420);
E、 p = payload.setweight(420);
F、 p = new payload(); p.setweight(420);
A
2020年12月03日
收藏