class CalcThread extends Thread {
    private double Result;

    public void run() {
        Result = calculate();
    }

    public double result() {
        return Result;
    }

    public double calculate() {
        // ...
    }
}
        
class Join {
    public static void main(String[] args) {
        CalcThread calc = new CalcThread();
        calc.start();
        doSomethingElse();
        try {
            calc.join();
            System.out.println("result is "
                + calc.result());
        } catch (InterruptedException e) {
            System.out.println("No answer: interrupted");
        }
    }

}