×

Special Offer! Sale of the Month | Extra 20% Off - Ends In Coupon code: DG2020

Free Online Oracle 1Z0-809 Practice Test

Prepare Your Oracle 1Z0-809 Exam Questions with Free online 1Z0-809 Practice Test. Get Brilliant Java SE 8 Programmer II Exam Results with Valid 1Z0 809 Exam Dumps.

Page:    1 / 94      
Total 469 Questions | Updated On: Apr 23, 2024
Question 1

Given:
class FuelNotAvailException extends Exception { }
class Vehicle {
 void ride() throws FuelNotAvailException { //line n1
 System.out.println(“Happy Journey!”);
 }
}
class SolarVehicle extends Vehicle {
 public void ride () throws Exception { //line n2
 super ride ();
 }
}
and the code fragment:
public static void main (String[] args) throws FuelNotAvailException, Exception
 {
 Vehicle v = new SolarVehicle ();
 v.ride();
}
Which modification enables the code fragment to print Happy Journey!?


Answer: B
Question 2

The last statement inside main(String []) method, increments value of i, which means it is not effectively final and hence compilation error.

//Test.java

package com.udayan.ocp;

 

class Player {

    String name;

    int age;

    Player() {

        this.name = "Virat";

        this.age = 29;

    }

    

    public int hashCode() {

        return 100;

    }

}

 

public class Test {

    public static void main(String[] args) {

        System.out.println(new Player());

    }

}

Hexadecimal representation of 100 is 64.

Which of the following option is correct?


Answer: B
Question 3

You want to create a singleton class by using the Singleton design pattern. Which two statements enforce the singleton nature of the design? (Choose two.)


Answer: A,B
Question 4

Given:
public class Counter {
 public static void main (String[ ] args) {
 int a = 10;
 int b = -1;
 assert (b >=1) : “Invalid Denominator”;
 int с = a / b;
 System.out.println (c);
 }
}
What is the result of running the code with the –da option?


Answer: A
Question 5

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.*;

4.  

5. public class Test {

6.     public static void main(String[] args) {

7.         NavigableMap map = new TreeMap<>();

8.         map.put(25, "Pune");

9.         map.put(32, "Mumbai");

10.         map.put(11, "Sri Nagar");

11.         map.put(39, "Chennai");

12.  

13.         System.out.println(map.headMap(25, true));

14.     }

15. }


Answer: C
Page:    1 / 94      
Total 469 Questions | Updated On: Apr 23, 2024

© Copyrights DumpsCertify 2024. All Rights Reserved

We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the DumpsCertify.