There is no direct method to stop a thread. Earlier there used to be methods like Thread.stop(), however now these are deprecated. So how can we stop a thread if there is no 'stop' method?
To understand the answer, we first need to understand the thread and its working. For understanding the thread, please refer to other post 'What is Thread'. So one thread performs a assigned work at a time and its life is over once this work is done. Like if we take example quoted in 'What is Thread' post, then a painting work assigned to a sub-contractor is the life of relation with him. As soon as, he will complete his painting work, the sub-contracting relation will end.
So the right way to stop a thread is to complete its work, or to make it understand that its work is over and it has to exit. For example, Painting contractor can ask the sub-contractor painter while assigning the job that please work till you finish painting in this service or till I call you to come out of this room. So the sub-contractor will start painting and will automatically exit from the relation as soon as it will finish the painting. Alternatively Painting Contractor can call him in-between and so the sub-contractor will keep on checking that whether the contractor is calling him or not. If not, he will continue with his work till its completion. If yes, he will leave the work and exit the room.