リンさんとモバ友になろう!
日記・サークル・友達・楽しみいっぱい!
-
- 2011/8/5 1:32
- let's challenge!!
-
- コメント(5)
- 閲覧(30)
-
-
- 今月資格試験です(-_-;)
11. class Payload {
12. private int weight;
13. public Payload() {}
14. public Payload(int wt) { weight = wt; }
15. public void setWeight(int w) {weight = w; }
16. public String toString() {return Integer.toString(weight); }
17. }
18.
19. public class TestPayload {
20. static void changePayload(Payload p) {
21. /* insert code here */
22. }
23.
24. public static void main(String[] args) {
25. Payload p = new Payload();
26. p.setWeight(1024);
27. changePayload(p);
28. System.out.println("The value of p is "+ p);
29. }
30.}
"The value of p is 420."と出力されるには、 21目にどのコードを挿入すれば良いですか?
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);
試験練習の問題☆
解けたらジュースおごりますよ☆
正解今度教えます☆
- 今月資格試験です(-_-;)