ExamQuestions.com

Register
Login
Java SE 8 Programmer II Exam Questions

Oracle

Java SE 8 Programmer II

73 / 130

Question 73:

Given the code fragment: class CallerThread implements Callable<String>{ String str; public CallerThread(String s) {this.str=s;} public String call() throws Exception { return str.concat("Call"); } } and public static void main (String[] args) throws InterruptedException, ExecutionException { ExecutorService es = Executors.newFixedThreadPool(4);//line n1 Future f1 = es.submit (newCallerThread("Call")); String str = f1.get().toString(); System.out.println(str); } Which statement is true? 

Answer options:

A. The program prints Call Call and terminates.
B. The program prints Call Call and does not terminate.
C. A compilation error occurs at line n1.
D. An ExecutionException is thrown at run time.