1z0-809 Korean 無料問題集「Oracle Java SE 8 Programmer II (1z0-809 Korean Version)」
주어진 코드 조각:
클래스 호출자는 Callable<String> {을 구현합니다.
문자열 str;
공개 호출자(문자열 s) {this.str=s;}
공개 문자열 call() 예외 발생 { return str.concat("호출자");}
}
클래스 러너는 Runnable {을 구현합니다.
문자열 str;
공개 러너(문자열 s) {this.str=s;}
공개 무효 실행() { System.out.println(str.concat("실행자"));}
}
그리고
public static void main(String[] args)는 InterruptedException, ExecutionException을 던집니다. { ExecutorService es = Executors.newFixedThreadPool(2); 미래 f1 = es.submit(새 발신자("호출")); 미래 f2 = es.submit(새로운 러너("실행")); 문자열 str1 = (문자열) f1.get(); 문자열 str2 = (문자열) f2.get();//라인 n1 System.out.println(str1+ ":" + str2);
}
결과는 무엇입니까?
클래스 호출자는 Callable<String> {을 구현합니다.
문자열 str;
공개 호출자(문자열 s) {this.str=s;}
공개 문자열 call() 예외 발생 { return str.concat("호출자");}
}
클래스 러너는 Runnable {을 구현합니다.
문자열 str;
공개 러너(문자열 s) {this.str=s;}
공개 무효 실행() { System.out.println(str.concat("실행자"));}
}
그리고
public static void main(String[] args)는 InterruptedException, ExecutionException을 던집니다. { ExecutorService es = Executors.newFixedThreadPool(2); 미래 f1 = es.submit(새 발신자("호출")); 미래 f2 = es.submit(새로운 러너("실행")); 문자열 str1 = (문자열) f1.get(); 문자열 str2 = (문자열) f2.get();//라인 n1 System.out.println(str1+ ":" + str2);
}
결과는 무엇입니까?
正解:A
解答を投票する