[Solved] Java multithreading without thread class or runnable interface


Every thread in a Java program must have an associated Thread instance, and every Thread “has” a Runnable.* There’s no way around it. It’s just how Java works. You can call Thread.currentThread() from anywhere in your program and it will always return a reference to the Thread object that controls the thread that is executing your code.

That being said, there are plenty of different ways (e.g., thread pools, thread factories, the streams API) that the library will create new Thread objects on your program’s behalf so that you can get multiple threads running your code without you having to explicitly write new Thread(...) anywhere.


* Scare quotes around “has” because sometimes the Thread instance is its own Runnable.

solved Java multithreading without thread class or runnable interface