It sounds like you don’t have to do these tasks in separate threads at all, but if you really want you to be able to do something like this:
A a = new A();
a.start();
a.join();
B b = new B();
b.start();
b.join();
, A B Thread, Runnable Thread (Runnable).start().
Executor A B Runnable ( Thread). :
ExecutorService ex = Executors.newSingleThreadExecutor();
ex.execute(new A());
ex.execute(new B());
A B .