Gestion des Exception: Ajouter une exécution dans la section finaly

Author:


Download

 
class MonException extends Exception
{
 
}
 
public class ExempleFinaly {
 
  static int x = 0;
 
  public static void main(String[] args) {
    while (true) {
      try {
        if (x++ == 0)
          throw new MonException();
        System.out.println("No exception");
      } catch (MonException e) {
        System.err.println("MonException");
      } finally {
        System.err.println("Bloque Ex�cut� apr�s la gestion de l'exception");
        if (x == 2)
          break;
      }
    }
  }
}