How-to articles, tricks, and solutions about IMPLEMENTS

"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.

Implements vs extends: When to use? What's the difference?

In Java, the extends keyword is used to inherit from a superclass, and the implements keyword is used to implement an interface. Here are the key differences between the two: