Given the code fragments:
class Caller implements Callable<String> {
String str;
public Caller (String s) {this.str=s;}
public String call()throws Exception { return str.concat ("Caller");}
}
class Runner implements Runnable {
String str;
public Runner (String s) {this.str=s;}
public void run () { System.out.println (str.concat ("Runner"));}
}
and
public static void main (String[] args) throws InterruptedException, ExecutionException {
ExecutorService es = Executors.newFixedThreadPool(2);
Future f1 = es.submit (new Caller ("Call"));
Future f2 = es.submit (new Runner ("Run"));
String str1 = (String) f1.get();
String str2 = (String) f2.get(); //line n1
System.out.println(str1+ ":" + str2);
es.shutdown();
}
What is the result?
DarGrin
5 days, 21 hours agoduydn
8 months, 3 weeks agoWilsonKKerll
2 years, 2 months agoSvetleto13
3 years agoHuim
3 years agojduarte
3 years, 1 month agojduarte
3 years, 4 months agoAbdullah_Rahahleah
3 years, 5 months ago