terminate a thread java

Java
/** * Java Program to demonstrate how to stop a thread in Java. * There is a stop() method in Thread class but its deprecated * because of deadlock and other issue, but its easy to write * your own stop() method to stop a thread in Java. * * @author java67 */

Read more: https://www.java67.com/2015/07/how-to-stop-thread-in-java-example.html#ixzz6GEVj3nn0
Source

Also in Java: