Java Magazine, Nov/Dec 2016
ORACLE COM JAVAMAGAZINE NOVEMBER DECEMBER 2016 68 fix this b true false c false true d false false e An exception at line n1 Question 4 Given the following code class MyResource implements AutoCloseable private String name public MyResource String name this name name @ Override public void close System out println name public class ResourceHog public static void main String args try MyResource one new MyResource one MyResource two new MyResource two finally System out println three What is the result Choose one a one two three b three two one c three one two d two one three e The words one two and three are all output but the order is not determined Question 5 Given this code class MyJobException extends Exception class Job implements Callable String public String call throws MyJobException line n1 return Done public class Jobs public static void main String args ExecutorService es Executors newFixedThreadPool 3 Future String handle es submit new Job try String rv handle get line n2 catch InterruptedException ex ex printStackTrace line n3
You must have JavaScript enabled to view digital editions.