Question:

Which of the following is true?

public class A {
  public String foo() {
    return "a";
  }
}

public class B extends A {
  public String foo() {
    return "b";
  }
}

public class Main {
  public static void main(String[] args) {
    A a = (A) new B();
    System.out.println(a.foo());
  }
}

Answers:


Keywords:

© 2017 QuizBucket.org