/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.concurrent.CompletableFuture;
import java.lang.Thread;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    CompletableFuture<Void> s = new CompletableFuture();
	    CompletableFuture<Void> f = new CompletableFuture();
	    
	    CompletableFuture<Void> someContext =  CompletableFuture.supplyAsync(() ->
	    {
	    	try{
	    		
	    	
			System.out.println(Thread.currentThread().getId());
		    CompletableFuture<String> update =
	        CompletableFuture.supplyAsync(
	            () -> {
	              String ans = null;
	              try {
	                System.out.println(Thread.currentThread().getId());
	                ans = "Hello";
	              } catch (Exception e) {
	                ans = e.toString();
	              } finally {
	              	s.complete(null);
	              	return ans;
	              }
	            });
		    s.get();
		    System.out.println(s.isDone());
	    	} catch (Exception e) {
	    		System.out.println("Some error");
	    		return null;
	    	}
		    return null;
	    });
	    
	    System.out.println(f.isDone());
	}
}