Quantcast
Channel: "implements Runnable" vs "extends Thread" in Java - Stack Overflow
Viewing all articles
Browse latest Browse all 45

Answer by Jon Skeet for "implements Runnable" vs "extends Thread" in Java

$
0
0

Yes: implements Runnable is the preferred way to do it, IMO. You're not really specialising the thread's behaviour. You're just giving it something to run. That means composition is the philosophically "purer" way to go.

In practical terms, it means you can implement Runnable and extend from another class as well.


Viewing all articles
Browse latest Browse all 45

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>