black

SCJP程序员认证考试

登录

单项选择题

11. class Payload { 
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);

相关考题

多项选择题 11.publicclassCommander{ 12.publicstaticvoidmain(String[]args){ 13.StringmyProp=/*insertcodehere*/ 14.System.out.println(myProp); 15.} 16.} andthecommandline: java-Dprop.custom=gobstopperCommander Whichtwo,placedonline13,willproducetheoutputgobstopper?()

单项选择题 public class Yippee2 {  static public void main(String [] yahoo) {  for(int x= 1; xSystem.out.print(yahoo[x] + “ “);  }  }  }  and the command line invocation: java Yippee2 a b c What is the result?()

单项选择题 public class Yippee {  public static void main(String [] args) {  for(int x = 1; x < args.length; x++) {  System.out.print(args[x] +“ “);  }  }  }  and two separate command line invocations:  java Yippee  java Yippee 1234  What is the result?()

All Rights Reserved 版权所有©考试题库网(kstiku.com)

备案号:湘ICP备14005140号-3

经营许可证号:湘B2-20140064