Java Timer cancel() MethodThe cancel() is the method of Timer class is used to stop the timer and remove the currently scheduled task. Note: It is permissible to call this method from within a task scheduled on this timer.SyntaxExample 1Test it NowOutput: working on working on working on working on working on Task is stop Example 2Test it NowOutput: working on working on working on working on working on Task is stop working on Task is stop working on Task is stop working on Task is stop working on Task is stop working on Task is stop
Next TopicJava Timer
|