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

Java认证考试

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

interface A { public int getValue() }  class B implements A {  public int getValue() { return 1; }  }  class C extends B {  // insert code here  }  Which three code fragments, inserted individually at line 15, make use of polymorphism?()

  • A、 public void add(C c) { c.getValue(); }
  • B、 public void add(B b) { b.getValue(); }
  • C、 public void add(A a) { a.getValue(); }
  • D、 public void add(A a, B b) { a.getValue(); }
  • E、 public void add(C c1, C c2) { c1.getValue(); }
正确答案:B,C,D
答案解析:
进入题库查看解析

微信扫一扫手机做题