import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        System.out.println(System.getProperty("java.version"));
        CompletableFuture<?> f = CompletableFuture.supplyAsync(() -> false);
        f.cancel(true); // Stack trace makes it look as though CompletionException is thrown here
        try {
            f.join(); // Actually, CompletionException is thrown here.
        } catch (CancellationException e) {
            System.out.println("Exception was thrown from f.join()");
            e.printStackTrace(System.out);
        }
    }
} 