package jvm.createthread;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class CreateByCallable implements Callable<String> {
    @Override
    public String call() throws Exception {
        return "create by implementing Callable";
    }

    public static void main(String[] args) {
        CreateByCallable createByCallable = new CreateByCallable();
        FutureTask<String> futureTask = new FutureTask<>(createByCallable);
        new Thread(futureTask).start();
        try {
            System.out.println(futureTask.get());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
