Java Threads Question:

Download Job Interview Questions and Answers PDF

How do I create a Runnable with inheritance?

Java Threads Interview Question
Java Threads Interview Question

Answer:

To introduce a Runnable type to an existing class hierarchy, you need to create a sub-class that declares that it implements the Runnable interface, and provide a run method to fulfil the interface. This combination of interface and inheritance means that runnable implementations can be very minor extensions of existing classes

Download Java Threads Interview Questions And Answers PDF

Previous QuestionNext Question
Do I need to use synchronized on setValue(int)?What are three ways in which a thread can enter the waiting state?
Or
What are different ways in which a thread can enter the waiting state?