Labour Day Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: get65

Oracle Updated 1z0-809 Exam Questions and Answers by juliette

Page: 4 / 7

Oracle 1z0-809 Exam Overview :

Exam Name: Java SE 8 Programmer II
Exam Code: 1z0-809 Dumps
Vendor: Oracle Certification: Java SE
Questions: 196 Q&A's Shared By: juliette
Question 16

Given the code fragment:

public class FileThread implements Runnable {

String fName;

public FileThread(String fName) { this.fName = fName; }

public void run () System.out.println(fName);}

public static void main (String[] args) throws IOException, InterruptedException {

ExecutorService executor = Executors.newCachedThreadPool();

Stream listOfFiles = Files.walk(Paths.get(“Java Projects”));

listOfFiles.forEach(line -> {

executor.execute(new FileThread(line.getFileName().toString())); //

line n1

});

executor.shutdown();

executor.awaitTermination(5, TimeUnit.DAYS);//

line n2

}

}

The Java Projects directory exists and contains a list of files.

What is the result?

Options:

A.

The program throws a runtime exception at line n2.

B.

The program prints files names concurrently.

C.

The program prints files names sequentially.

D.

A compilation error occurs at line n1.

Discussion
Question 17

Given the code fragment:

Path file = Paths.get (“courses.txt”);

// line n1

Assume the courses.txt is accessible.

Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file?

Options:

A.

List fc = Files.list(file);fc.stream().forEach (s - > System.out.println(s));

B.

Stream fc = Files.readAllLines (file);fc.forEach (s - > System.out.println(s));

C.

List fc = readAllLines(file);fc.stream().forEach (s - > System.out.println(s));

D.

Stream fc = Files.lines (file);fc.forEach (s - > System.out.println(s));

Discussion
Ella-Rose
Amazing website with excellent Dumps. I passed my exam and secured excellent marks!!!
Alisha (not set)
Extremely accurate. They constantly update their materials with the latest exam questions and answers, so you can be confident that what you're studying is up-to-date.
Hassan
Highly Recommended Dumps… today I passed my exam! Same questions appear. I bought Full Access.
Kasper (not set)
Hey wonderful….so same questions , sounds good. Planning to write this week, I will go for full access today.
Reeva
Wow what a success I achieved today. Thank you so much Cramkey for amazing Dumps. All students must try it.
Amari (not set)
Wow, that's impressive. I'll definitely keep Cramkey in mind for my next exam.
Everleigh
I must say that they are updated regularly to reflect the latest exam content, so you can be sure that you are getting the most accurate information. Plus, they are easy to use and understand, so even new students can benefit from them.
Huxley (not set)
That's great to know. So, you think new students should buy these dumps?
Nadia
Why these dumps are important? Can I pass my exam without these dumps?
Julian (not set)
The questions in the Cramkey dumps are explained in detail and there are also study notes and reference materials provided. This made it easier for me to understand the concepts and retain the information better.
Question 18

Given the code fragment:

Stream> iStr= Stream.of (

Arrays.asList (“1”, “John”),

Arrays.asList (“2”, null)0;

Stream< nInSt = iStr.flatMapToInt ((x) -> x.stream ());

nInSt.forEach (System.out :: print);

What is the result?

Options:

A.

1John2null

B.

12

C.

A NullPointerException is thrown at run time.

D.

A compilation error occurs.

Discussion
Question 19

Given:

class Worker extends Thread {

CyclicBarrier cb;

public Worker(CyclicBarrier cb) { this.cb = cb; }

public void run () {

try {

cb.await();

System.out.println(“Worker…”);

} catch (Exception ex) { }

}

}

class Master implements Runnable { //line n1

public void run () {

System.out.println(“Master…”);

}

}

and the code fragment:

Master master = new Master();

//line n2

Worker worker = new Worker(cb);

worker.start();

You have been asked to ensure that the run methods of both the Worker and Master classes are executed.

Which modification meets the requirement?

Options:

A.

At line n2, insert CyclicBarrier cb = new CyclicBarrier(2, master);

B.

Replace line n1 with class Master extends Thread {

C.

At line n2, insert CyclicBarrier cb = new CyclicBarrier(1, master);

D.

At line n2, insert CyclicBarrier cb = new CyclicBarrier(master);

Discussion
Page: 4 / 7

1z0-809
PDF

$35  $99.99

1z0-809 Testing Engine

$42  $119.99

1z0-809 PDF + Testing Engine

$56  $159.99