Object Oriented Programming
Multithreading
Thread based process
Two ways to create thread in java

Life cycle of thread:
Every application in java are single threaded
Sequence is not predictable in the case of multithreading
Implementing runnable is the best practise
Cuz it can be extended
Race Condition
| Extending Thread | Implementing Runnable |
|---|---|
| Basicallyfor creating worker thread | Basically for defining task |
| It itself is a Thread Simple syntax | Thread object wraps Runnable object |
| Can not extend any other class | Can extend any other class |
| A functionality is executed only once on a thread instance | A functionality can be executed more than once by multiple worker threads |
| Concurrent framework does have limited support | Concurrent framework provide extensive support |
| Thread’s life cycle methods like interrupt() can be overridden | Only run() method can be overridden |
Synchronized block
Must be used inside synchronized block or method
If used outside of Synchronized block it throws exception: Illigal–
Happy Coding : @Sai Kishore