Java TimerTask cancel() MethodThe cancle() is the method of TimerTask class. This method is used to stop the timer task if the task is scheduled for 1-time execution or has not been run. It will never run again if the task has been scheduled for repeated execution. SyntaxReturnIt returns true if the task is scheduled for 1-time execution and has not yet run and returns false if the task was scheduled for 1-time execution and has already run, Example 1Output: Task Timer is on Task Timer is on Task Timer is on Task Timer is on Task Timer is on Task Timer is on Task Timer is on Task Timer is on Task Timer is on Task Timer is on Task Timer cancel: true Example 2Output: Task Timer is on Task Timer cancel: true Next TopicJava-timertask-run-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India