Finally

public class FinallyCodeExceptionPG {

public static void main(String[] args) {

try{
     int i = 55/5;
}
catch (ArithmeticException e){System.out.println(e);}
finally {System.out.println("finally always executed");}

System.out.println("Executed normal flow");
}

}

  • This keyword generally would be executed before terminating the program.
  • Finally must be followed by try and catch block.