0
Which is the best practise in threads to implement Runnable interface or extending thread class?
3 Réponses
+ 3
Hmm, try not to extend the Thread class (or any other class in the standard library for that matter) and implement Runnable instead.
However, there is an even cleaner way of doing things: `Future`s and `FutureTask`s. Basically they are functions which you then `.submit()` to a so-called `Executor`, which does all the threading behind the scenes. This way you don't need to create any Threads at all. Check them out some time, they are really neat! If you are using Java 8 they are even nicer to work with (using lambdas).
+ 1
Runnable interface is preferable because it keeps your option of inheriting a super class open if needed in future.
0
That's good from you @Schindlabua