Aniket Harode wrote:Why we write the shutdown in the finally statement? and from the below prog. why the shutdown is first exceuted then the thread opertion is worked but it has to work like the first the thread operation is performed then the shutdown
Well, it is your code, isn't it? The shutdown() method call is in the finally block because you coded it that way.
As for why the tasks still run, even after shutdown() has been called, it is because it is a graceful shutdown. The tasks in the executor are allowed to complete -- although no new tasks may be added.
Henry