How-to articles, tricks, and solutions about JAVA-THREADS

"implements Runnable" vs "extends Thread" in Java

In Java, you can create a thread in two ways: by implementing the Runnable interface or by extending the Thread class.

Difference between "wait()" vs "sleep()" in Java

In Java, the wait() method is used to pause the current thread and allow other threads to execute. It is called on an object and causes the current thread to wait until another thread calls the notify() or notifyAll() method on the same object.