Stopping a thread with Thread.stop causes it to release all of the monitors that it has locked. If any of the objects previously protected by these monitors were in an inconsistent state, the damaged objects become visible to other threads, which might lead to unpredictable behavior.
How to stop the thread, as stop() method is deprecated in java
1. Infinitely running thread can be stopped using boolean variable.
2. Infinitely running thread can be stopped using interrupt() method.
When thread is interrupted, if it in waiting state caused by invocation of wait(), sleep or join() method then its interrupt status will be cleared and it will receive an InterruptedException.