Finally is used in Java exceptional handling when we use try/catch block. Finally block gets executed even if there is exception in code. Mostly finally block is used to clean the code post execution or closing the existing connections.