Aliensbrain
  • Home
  • Topics
  • Quizzes
  • Notebooks
  • Community
  • Sign in
  • programming languages Online Quiz - 16
  • What is the result of the following code? 1. public abs...

What is the result of the following code? 1. public abstract class Catchable { 2. protected abstract void catchAnObject(Object x); 3. 4. public static void main(String [] args) { 5. java.util.Date now = new java.util.Date(); 6. Catchable target = new MyStringCatcher(); 7. target.catchAnObject(now); 8. } 9. } 10. 11. class MyStringCatcher extends Catchable { 12. public void catchAnObject(Object x) { 13. System.out.println("Caught object"); 14. } 15. 16. public void catchAnObject(String s) { 17. System.out.println("Caught string"); 18. } 19. }

technology programming languages
  1. Caught string

  2. Caught object

  3. Compiler error on line 12

  4. Compiler error on line 2


Show answer
Correct Option: B

Find more quizzes:

© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy