Given the code fragment:
Which two modifications, when made independently, enable the code to print joe:true: 100.0? (Choose
two.)
Given code of Test.java file:1. package com.sampleproject.oca;2. 3. abstract class Animal {4. abstract void jump() throws RuntimeException;5. }6. 7. class Deer extends Animal {8. void jump() { //Line n19. System.out.println("DEER JUMPS");10. }11. 12. void jump(int i) {13. System.out.println("DEER JUMPS TO " + i + " FEET");14. }15. }16. 17. public class Test {18. public static void main(String[] args) {19. Animal animal = new Deer();20. ((Deer)animal).jump(); //Line n221. ((Deer)animal).jump(5); //Line n322. }23. }What will be the result of compiling and executing Test class?
Given:
and the code fragment:
What is the result?
Given code of Test.java file:1. package com.sampleproject.oca;2. 3. interface Blogger {4. default void blog() throws Exception {5. System.out.println("GENERIC");6. }7. }8. 9. class TravelBlogger implements Blogger {10. public void blog() {11. System.out.println("TRAVEL");12. }13. }14. 15. public class Test {16. public static void main(String[] args) {17. Blogger blogger = new TravelBlogger(); //Line n118. ((TravelBlogger)blogger).blog(); //Line n219. }20. }What will be the result of compiling and executing Test class?
Given the code fragment:
What is the result?
© Copyrights FreePDFQuestions 2026. All Rights Reserved
We use cookies to ensure that we give you the best experience on our website (FreePDFQuestions). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the FreePDFQuestions.