Tuesday, April 08, 2025

LATEST UPDATES
>> What is the difference between continue and break statement?  >> What is a singleton class? Give a practical example of its usage.  >> What’s the purpose of Static methods and static variables?  >> What are the various access specifiers for Java classes?  >> What is the difference between an Inner Class and a Sub-Class?    

Friday, 18 November 2016

Explain different ways of creating a thread. Which one would you prefer and why ?

There are three ways that can be used in order for a Thread to be created:
  • A class may extend the Thread class.
  • A class may implement the Runnable interface.
  • An application can use the Executor framework, in order to create a thread pool.
The Runnable interface is preferred, as it does not require an object to inherit the Thread class. 

No comments:

Post a Comment

Designed By Seo Blogger Templates