We have two methods to create methods the threads.
1. Implementing runnable interface
2. Extending to thread class and overriding run method.
Among these two which one is better and why?
Please explain me in detail.
Answer Posted / venkat
implementing runnable interface is better than extending to
thread why because if u implements from runnable interface u
can have chance to extend one more class.but incase of
extending thread this facility is not there
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is a protected method?
What is return used for in java?
What is bufferedwriter?
What is Java Annotations?
What is arguments in java?
What are bind parameters?
What are data types in programming?
How to do a true java ping from windows?
What is jvm? Why is java called the platform independent programming language?
how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT
What is the use of :: in java?
What is a Transient Object?
Difference between method overloading and overriding.
How do you declare an array in java?
Can Exception handling we can handle multiple catch blocks?