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) 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);
}
What is the result?
pridemore
Highly Voted 3 years, 10 months agoasdfjhfgjuaDCV
Most Recent 9 months, 3 weeks agosteefaand
10 months, 3 weeks agoiSnover
11 months, 1 week agor1muka5
1 year, 10 months agoWilsonKKerll
2 years, 9 months agoSvetleto13
3 years, 7 months agoInnovation
4 years, 11 months agoInnovation
4 years, 11 months agoM_Jawad
4 years, 11 months ago