answer : C
theoretically it could return : Pong Ping
B. not compiled method execute is void
D. it will not compile
the invokeAny method parameter has to be a type of Collection
<T> T invokeAny(Collection<? extends Callable<T>> tasks)
only C:
D:cannot because invokeany return a Result of callables completely ok.
Future<String> future = executor.invokeAny(List.of(new Callable<String>(){
public String call() throws Exception {
return "PONG";
};
}));
A: call method of callabe return a type String not a future and callabe cannot be asigned to future directry
B: compile error BECAUSE Future<String> future = service.submit(()->"Pong"); is not a runnable
C: Future<String> future = service.submit(()->"Pong"); => ok
D: invoke any acept Collection of callable not a single callable
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ASPushkin
1 week, 6 days agod7bb0b2
6 months agod7bb0b2
5 months agoTheOneAboveAll
8 months agoOmnisumem
8 months, 2 weeks ago[Removed]
9 months, 2 weeks agoJtic
1 year, 3 months ago