// Import necessary classes import java.util.concurrent.Callable; import java.util.concurrent.FutureTask; import java.util.concurrent.ExecutionException; // HelloWorldCallable class implementing the Callable interface public class HelloWorldCallable implements Callable { @Override public String call() throws Exception { // Return a value when the thread completes return "Hello, World from a Callable!"; } public static void main(String[] args) throws InterruptedException, ExecutionException { // Create a FutureTask that wraps the HelloWorldCallable FutureTask futureTask = new FutureTask<>(new HelloWorldCallable()); // Create a new Thread with the FutureTask Thread myThread = new Thread(futureTask); // Start the thread myThread.start(); // Get the result of the computation String result = futureTask.get(); System.out.println(result); } }