Free Oracle 1z1-809 Exam Dumps Questions & Answers
| Exam Code/Number: | 1z1-809Join the discussion |
| Exam Name: | Java SE 8 Programmer II |
| Certification: | Oracle |
| Free Question Number: | 209 |
| Publish Date: | Aug 17, 2026 |
| # of views: | 2965 |
|
|
|
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 Projects directory exists and contains a list of files.
What is the result?
Given the code fragment:
String str = "Java is a programming language";
ToIntFunction<String> indexVal = str: : indexOf; //line n1
int x = indexVal.applyAsInt("Java");//line n2
System.out.println(x);
What is the result?
Given:
IntStream stream = IntStream.of (1,2,3);
IntFunction<Integer> inFu= x -> y -> x*y;//line n1
IntStream newStream = stream.map(inFu.apply(10));//line n2
newStream.forEach(System.out::print);
Which modification enables the code fragment to compile?

