Start of a new thread and waiting for the operation to complete in Java

class AddThread extends Thread {
    private int add(int aint b) {
        return a + b;
    }
    
    public void run(){
        int result = add(3, 5);
        System.out.println("result: " + result);
    }
}

AddThread thread = new AddThread();
thread.setPriority(Thread.MIN_PRIORITY);
thread.start();
//wait until thread is terminated
thread.join();

System.out.println("main thread");
//output:
//result: 8
//main thread