Month End Special 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sale65best

How to Pass the Oracle 1z0-809 Exam: Comprehensive Java SE 8 Programmer II Guide and Tips

Questions 51

Given:

1z0-809 Question 51

Which option fails?

Options:
A.

Foo mark = new Foo (“Steve”, 100);

B.

Foo pair = Foo.twice (“Hello World!”);

C.

Foo percentage = new Foo(“Steve”, 100);

D.

Foo grade = new Foo <> (“John”, “A”);

Oracle 1z0-809 Premium Access
Questions 52

Given the code fragment:

public void recDelete (String dirName) throws IOException {

File [ ] listOfFiles = new File (dirName) .listFiles();

if (listOfFiles ! = null && listOfFiles.length >0) {

for (File aFile : listOfFiles) {

if (aFile.isDirectory ()) {

recDelete (aFile.getAbsolutePath ());

} else {

if (aFile.getName ().endsWith (“.class”))

aFile.delete ();

}

}

}

}

Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.

What is the result?

Options:
A.

The method deletes all the .class files in the Projects directory and its subdirectories.

B.

The method deletes the .class files of the Projects directory only.

C.

The method executes and does not make any changes to the Projects directory.

D.

The method throws an IOException.

Questions 53

Given the code fragment:

Map books = new TreeMap<>();

books.put (1007, “A”);

books.put (1002, “C”);

books.put (1001, “B”);

books.put (1003, “B”);

System.out.println (books);

What is the result?

Options:
A.

{1007 = A, 1002 = C, 1001 = B, 1003 = B}

B.

{1001 = B, 1002 = C, 1003 = B, 1007 = A}

C.

{1002 = C, 1003 = B, 1007 = A}

D.

{1007 = A, 1001 = B, 1003 = B, 1002 = C}

Questions 54

Given:

1z0-809 Question 54

and the code fragment:

1z0-809 Question 54

The threads t1 and t2 execute asynchronously and possibly prints ABCA or AACB.

You have been asked to modify the code to make the threads execute synchronously and prints ABC.

Which modification meets the requirement?

Options:
A.

start the threads t1 and t2 within a synchronized block.

B.

Replace line n1 with:private synchronized int count = 0;

C.

Replace line n2 with:public synchronized void run () {

D.

Replace line n2 with:volatile int count = 0;

Questions 55

Which two statements are true about localizing an application? (Choose two.)

Options:
A.

Support for new regional languages does not require recompilation of the code.

B.

Textual elements (messages and GUI labels) are hard-coded in the code.

C.

Language and region-specific programs are created using localized data.

D.

Resource bundle files include data and currency information.

E.

Language codes use lowercase letters and region codes use uppercase letters.

Questions 56

Assume customers.txt is accessible and contains multiple lines.

Which code fragment prints the contents of the customers.txt file?

Options:
A.

Stream stream = Files.find (Paths.get (“customers.txt”));stream.forEach((String c) -> System.out.println(c));

B.

Stream stream = Files.find (Paths.get (“customers.txt”));stream.forEach( c) -> System.out.println(c));

C.

Stream stream = Files.list (Paths.get (“customers.txt”));stream.forEach( c) -> System.out.println(c));

D.

Stream lines = Files.lines (Paths.get (“customers.txt”));lines.forEach( c) -> System.out.println(c));

Questions 57

Given:

1z0-809 Question 57

What change should you make to guarantee a single order of execution (printed values 1 -100 in order)?

Options:
A.

Line 3: public synchronized void run() {

B.

Line 1: class MyClass extends Thread {

C.

Line 2: public volatile int value;

D.

Line 2: public synchronized int value;

Questions 58

Given:

1z0-809 Question 58

and the code fragment:

1z0-809 Question 58

What is the result?

Options:
A.

0.0

B.

1500.0

C.

A compilation error occurs.

D.

2000.0

Exam Code: 1z0-809
Certification Provider: Oracle
Exam Name: Java SE 8 Programmer II
Last Update: Jan 24, 2025
Questions: 196