DEVFYI - Developer Resource - FYI

What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?

Java Interview Questions and Answers (part 1)


(Continued from previous question...)

4. What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?

Strategically speaking, threads created by implementing Runnable interface are more advisable. If you create a thread by extending a thread class, you cannot extend any other class. If you create a thread by implementing Runnable interface, you save a space for your class to extend another class now or in future.

(Continued on next question...)

Other Interview Questions