What is the function of the boolean cancel(boolean mayInterruptIfRunning) method of the Future interface?

What is the function of the boolean cancel(boolean mayInterruptIfRunning) method of the Future interface?



Answer: Tries to cancel the execution of the thread; returns true if successful, but returns false in the case the thread finished normally by the time the method was called.


Learn More :

Multithreading and Concurrent Processing

Learn More Multiple Choice Question :