creation of thread in java different ways of creating threads in java creating new thread in java creation of multiple threads in java creating threads using Runnable interface creating threads using Thread Class
Different Ways orNumber of Ways to
Create a Thread:
In java programming threads
plays a crucial role in communication and transactions.
Thread is a flow of control it is used to execute the logic
of the program that is defined by
user.But in java programming, we have two ways to create a flow
of control(thread).
They are
1)
By using Java.Lang.Thread class
2)
By using Java.Lang.Runnable Interface
By using Thread class we can create thread object or thread directly.
But according
to user requirements if user defined class requires multiple
features then by extending
multiple classes into single classes(i:e multiple
inheritance) is not supported by java.
By using multiple inheritance we can over
come this problem by implementing interfaces.
So by implementing Runnable
interface we can achieve. But creation of runnable interface
object is in
direct.
In How Many Ways That We Can Create
Thread Object Or Thread ?
We
can create Object of the thread in two ways . By extending Thread class Object
and by implementing Runnable interface.
The following concepts are regarding Threading
- Multi Threading
- Life Cycle Of Threads
- Java.Lang.Thread
- Java.Lang.Runnable
- Internal Flow Of Thread
- Synchronization
- Inter Thread Communication
- Multi Threading PPT
- Thread Life Cycle PPT
No comments:
Post a Comment