Timer purge() in Java

purge(): This method is available in java.util.Timer class of Java.

Syntax:

int java.util.Timer.purge()

This method removes all canceled tasks from this timer's task queue.

Parameters: NA

Returns: the number of tasks removed from the queue.

Exceptions: NA

Approach

Java

import java.util.Timer;

public class Timerpurge {
    public static void main(String[] args) {

        Timer timer = new Timer();

        System.out.println(timer.purge());
    }
}

Output:

0


No comments:

Post a Comment