Java: Encore Le Mot clé finally

Author:


Download

public class ExceutionFinaly {
 
  public static void main(String[] args) {
    System.out.println("Le premier bloque de try");
    try {
      System.out.println("Try imbriqué");
      try {
        throw new Exception();
      } finally {
        System.out.println("finally dans le try imbriqué");
      }
    } catch (Exception e) {
      System.err.println("Attraper la première exception");
    } finally {
      System.err.println("finally de la première Exception");
    }
  }
}