Oracle 1Z0-809 Exam (page: 6)
Oracle Java SE 8 Programmer II
Updated on: 01-Sep-2025

Viewing Page 6 of 35

Given:
public class Emp {
String fName;
String lName;
public Emp (String fn, String ln) {
fName = fn;
lName = ln;
}
public String getfName() { return fName; }
public String getlName() { return lName; }
}

and the code fragment:

List<Emp> emp = Arrays.asList (
new Emp (“John”, “Smith”),
new Emp (“Peter”, “Sam”),
new Emp (“Thomas”, “Wale”));
emp.stream()
//line n1
.collect(Collectors.toList());

Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and then ascending order of lName?

  1. .sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing (Emp::getlName))
  2. .sorted (Comparator.comparing(Emp::getfName).thenComparing(Emp::getlName))
  3. .map(Emp::getfName).sorted(Comparator.reserveOrder())
  4. .map(Emp::getfName).sorted(Comparator.reserveOrder().map (Emp::getlName).reserved

Answer(s): B



Given:
public enum USCurrency {
PENNY (1),
NICKLE(5),
DIME (10),
QUARTER(25);

private int value;

public USCurrency(int value) {
this.value = value;
}
public int getValue() {return value;}
}
public class Coin {
public static void main (String[] args) {
USCurrency usCoin =new USCurrency.DIME;
System.out.println(usCoin.getValue()):
}
}

Which two modifications enable the given code to compile? (Choose two.)

  1. Nest the USCurrency enumeration declaration within the Coin class.
  2. Make the USCurrency enumeration constructor private.
  3. Remove the new keyword from the instantion of usCoin.
  4. Make the getter method of value as a static method.
  5. Add the final keyword in the declaration of value.

Answer(s): B,C



Given:
class ImageScanner implements AutoCloseable {
public void close () throws Exception {
System.out.print (“Scanner closed.”);
}
public void scanImage () throws Exception {
System.out.print (“Scan.”);
throw new Exception(“Unable to scan.”);
}
}
class ImagePrinter implements AutoCloseable {
public void close () throws Exception {
System.out.print (“Printer closed.”);
}
public void printImage () {System.out.print(“Print.”); }
}

and this code fragment:

try (ImageScanner ir = new ImageScanner();
ImagePrinter iw = new ImagePrinter()) {
ir.scanImage();
iw.printImage();
} catch (Exception e) {
System.out.print(e.getMessage());
}

What is the result?

  1. Scan.Printer closed. Scanner closed. Unable to scan.
  2. Scan.Scanner closed. Unable to scan.
  3. Scan. Unable to scan.
  4. Scan. Unable to scan. Printer closed.

Answer(s): A



Given the structure of the STUDENT table:
Student (id INTEGER, name VARCHAR)

Given:

public class Test {
static Connection newConnection =null;
public static Connection get DBConnection () throws SQLException {
try (Connection con = DriveManager.getConnection(URL, username, password)) {
newConnection = con;
}
return newConnection;
}
public static void main (String [] args) throws SQLException {
get DBConnection ();
Statement st = newConnection.createStatement();
st.executeUpdate(“INSERT INTO student VALUES (102, ‘Kelvin’)”);
}
}

Assume that:
The required database driver is configured in the classpath.
The appropriate database is accessible with the URL, userName, and passWord exists.
The SQL query is valid.

What is the result?

  1. The program executes successfully and the STUDENT table is updated with one record.
  2. The program executes successfully and the STUDENT table is NOT updated with any record.
  3. A SQLException is thrown as runtime.
  4. A NullPointerException is thrown as runtime.

Answer(s): C



Given the code fragments:
class Employee {
Optional<Address> address;
Employee (Optional<Address> address) {
this.address = address;
}
public Optional<Address> getAddress() { return address; }
}

class Address {
String city = “New York”;
public String getCity { return city: }
public String toString() {
return city;
}
}

and

Address address = null;
Optional<Address> addrs1 = Optional.ofNullable (address);
Employee e1 = new Employee (addrs1);
String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not
available”;

What is the result?

  1. New York
  2. City Not available
  3. null
  4. A NoSuchElementException is thrown at run time.

Answer(s): B



Viewing Page 6 of 35



Share your comments for Oracle 1Z0-809 exam with other users:

Tanvi Rajput 10/6/2023 6:50:00 AM

question 11: d i personally feel some answers are wrong.
UNITED KINGDOM


Anil 7/18/2023 9:38:00 AM

nice questions
Anonymous


Chris 8/26/2023 1:10:00 AM

looking for c1000-158: ibm cloud technical advocate v4 questions
Anonymous


sachin 6/27/2023 1:22:00 PM

can you share the pdf
Anonymous


Blessious Phiri 8/13/2023 10:26:00 AM

admin ii is real technical stuff
Anonymous


Luis Manuel 7/13/2023 9:30:00 PM

could you post the link
UNITED STATES


vijendra 8/18/2023 7:54:00 AM

hello send me dumps
Anonymous


Simeneh 7/9/2023 8:46:00 AM

it is very nice
Anonymous


john 11/16/2023 5:13:00 PM

i gave the amazon dva-c02 tests today and passed. very helpful.
Anonymous


Tao 11/20/2023 8:53:00 AM

there is an incorrect word in the problem statement. for example, in question 1, there is the word "speci c". this is "specific. in the other question, there is the word "noti cation". this is "notification. these mistakes make this site difficult for me to use.
Anonymous


patricks 10/24/2023 6:02:00 AM

passed my az-120 certification exam today with 90% marks. studied using the dumps highly recommended to all.
Anonymous


Ananya 9/14/2023 5:17:00 AM

i need it, plz make it available
UNITED STATES


JM 12/19/2023 2:41:00 PM

q47: intrusion prevention system is the correct answer, not patch management. by definition, there are no patches available for a zero-day vulnerability. the way to prevent an attacker from exploiting a zero-day vulnerability is to use an ips.
UNITED STATES


Ronke 8/18/2023 10:39:00 AM

this is simple but tiugh as well
Anonymous


CesarPA 7/12/2023 10:36:00 PM

questão 4, segundo meu compilador local e o site https://www.jdoodle.com/online-java-compiler/, a resposta correta é "c" !
UNITED STATES


Jeya 9/13/2023 7:50:00 AM

its very useful
INDIA


Tracy 10/24/2023 6:28:00 AM

i mastered my skills and aced the comptia 220-1102 exam with a score of 920/1000. i give the credit to for my success.
Anonymous


James 8/17/2023 4:33:00 PM

real questions
UNITED STATES


Aderonke 10/23/2023 1:07:00 PM

very helpful assessments
UNITED KINGDOM


Simmi 8/24/2023 7:25:00 AM

hi there, i would like to get dumps for this exam
AUSTRALIA


johnson 10/24/2023 5:47:00 AM

i studied for the microsoft azure az-204 exam through it has 100% real questions available for practice along with various mock tests. i scored 900/1000.
GERMANY


Manas 9/9/2023 1:48:00 AM

please upload 1z0-1072-23 exam dups
UNITED STATES


SB 9/12/2023 5:15:00 AM

i was hoping if you could please share the pdf as i’m currently preparing to give the exam.
Anonymous


Jagjit 8/26/2023 5:01:00 PM

i am looking for oracle 1z0-116 exam
UNITED STATES


S Mallik 11/27/2023 12:32:00 AM

where we can get the answer to the questions
Anonymous


PiPi Li 12/12/2023 8:32:00 PM

nice questions
NETHERLANDS


Dan 8/10/2023 4:19:00 PM

question 129 is completely wrong.
UNITED STATES


gayathiri 7/6/2023 12:10:00 AM

i need dump
UNITED STATES


Deb 8/15/2023 8:28:00 PM

love the site.
UNITED STATES


Michelle 6/23/2023 4:08:00 AM

can you please upload it back?
Anonymous


Ajay 10/3/2023 12:17:00 PM

could you please re-upload this exam? thanks a lot!
Anonymous


him 9/30/2023 2:38:00 AM

great about shared quiz
Anonymous


San 11/14/2023 12:46:00 AM

goood helping
Anonymous


Wang 6/9/2022 10:05:00 PM

pay attention to questions. they are very tricky. i waould say about 80 to 85% of the questions are in this exam dump.
UNITED STATES