Implementing runnable interface is more advantageous because when you are going for multiple inheritance, then only interface can help.
• If you are already inheriting a different class, then you have to go for Runnable Interface. Otherwise you can extend Thread class.
• Also, if you are implementing interface, it means you have to implement all methods in the interface.
• If we implement runnable interface it will provide better object oriented design
• Implementing also gives consistency
• By using runnable interface we can run the class several times whereas thread have start() method that can be called only once.
• If you are already inheriting a different class, then you have to go for Runnable Interface. Otherwise you can extend Thread class.
• Also, if you are implementing interface, it means you have to implement all methods in the interface.
• If we implement runnable interface it will provide better object oriented design
• Implementing also gives consistency
• By using runnable interface we can run the class several times whereas thread have start() method that can be called only once.
No comments:
Post a Comment