How to Stop a Thread

We can stop a Thread execution by using stop() method of Thread Class.

public void stop()

If we call stop() then immediatly the Thread will enter into dead state anyway stop method is depricated and not recommended to use.

How to Suspend and Resume a Thread

We can suspend a Thread by using suspend method of the Thread class, Then immediately Thread entered into a suspended state. We can resume a suspended Thread by using the resume method of the Thread class, Then immediately Thread can continue its execution.

public final void suspend();
public final void resume();

Anyway, both methods suspend() and resume() are deprecated and not recommended to use.

Similar Java Tutorials

Leave a Comment