1z0-809 Exam Question 126
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<Path> 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 Projectsdirectory exists and contains a list of files.
What is the result?
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<Path> 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 Projectsdirectory exists and contains a list of files.
What is the result?
1z0-809 Exam Question 127
Given:

and the code fragment:

Which modification enables the code fragment to print Speaker?

and the code fragment:

Which modification enables the code fragment to print Speaker?
1z0-809 Exam Question 128
Given:

What is the result?

What is the result?
1z0-809 Exam Question 129
Given:

What is the result?

What is the result?
1z0-809 Exam Question 130
Given:

And given the commands:

What is the result?

And given the commands:

What is the result?