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


Please Help Members By Posting Answers For Below Questions

How do you check if a string is lexicographically in java?

494


Is sizeof a preprocessor?

538


What is the use of pattern in java?

504


How do I compare two strings in word in java?

532


What is the most important feature of java? What is an interface?

509






What is unicode used for?

566


Explain the difference between intermediate and terminal operations in java8?

562


How does finally block differ from finalize() method?

578


Define "Access specifiers" in java.

606


How to solve the problem of generating the unique hash keys with hash function?

1453


Is java call by reference?

525


What is the purpose of garbage collection in java?

649


What is string data type?

547


Explain access modifiers in java.

578


What are the legal parameters?

501