what is the purpose of a finally clause?
Solution
finally clause is written after try-catch block.The finally clause is used to provide the capability to execute code no matter whether an exception is thrown or caught in previous try-catch block.This is usually used to close resources allocated inside try block.