多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

public class Item {  private String desc;  public String getDescription() { return desc; }  public void setDescription(String d) { desc = d; } public static void modifyDesc(Item item, String desc) {  item = new Item();  item.setDescription(desc);  }  public static void main(String[] args) {  Item it = new Item();  it.setDescription(”Gobstopper”);  Item it2 = new Item();  it2.setDescription(”Fizzylifting”);  modifyDesc(it, “Scrumdiddlyumptious”);  System.out.println(it.getDescription());  System.out.println(it2.getDescription());  }  }  What is the outcome of the code? ()

  • A、 Compilation fails.
  • B、 Gobstopper      Fizzylifting
  • C、 Gobstopper     Scrumdiddlyumptious
  • D、 Scrumdiddlyumptious     Fizzylifltng
  • E、 Scrumdiddlyumptious     Scrumdiddlyumptious
正确答案:B
答案解析:
进入题库查看解析

微信扫一扫手机做题