Skip to content

Instantly share code, notes, and snippets.

@rubykv
Created April 4, 2022 18:36
Show Gist options
  • Save rubykv/c3903b95aa570108f6ebc618606098ff to your computer and use it in GitHub Desktop.
Save rubykv/c3903b95aa570108f6ebc618606098ff to your computer and use it in GitHub Desktop.
public static void main(String[] args) throws InterruptedException, ExecutionException {
ExecutorService executor = Executors.newSingleThreadExecutor();
Future<Integer> cf = executor.submit(() -> {
return 1;
});
System.out.print("Result " + (cf.get() + 2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment