Multiple choice technology programming languages

Which the preferred way to write multithread programe ?

  1. Extend Thread class

  2. Implement Runnable interface

  3. Both

  4. None

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Implementing Runnable interface is preferred over extending Thread class because Java supports only single inheritance - by implementing Runnable, your class can still extend another class if needed. It also separates the task logic from the thread execution mechanism, following better object-oriented design principles. Extending Thread should only be used when you need to override Thread methods other than run().