Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

why Runnable interface is preferable than extending the
Thread class?

Answer Posted / myluvdeepu

if we extend thread then we can't extend other class.
but if we implement runnable interface we can implement as much interface as we can, there is no restriction.

thread call the run method automatically(if called with no-arg).but for runnable we need to call run method.
thread cause problem in multiple inheritance.
but runnable interface don't.

Is This Answer Correct ?    4 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you create a method in java?

1001


What is a nullable field?

1036


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread

1033


What is singleton service?

972


What is the difference between length and length() method in java?

1118


Why do we override tostring method in java?

961


is there a separate stack for each thread in java? : Java thread

975


Can we have any code between try and catch blocks?

988


What are triggers in DB? Explain their types. How do they work?

1090


What is the difference between abstract class and interface1? What is an interface?

1073


How do you remove an element from an arraylist in java?

1007


What are the fileinputstream and fileoutputstream?

1065


How do you escape in java?

1080


What does java edition mean?

1157


Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.

1058