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

Author:


{filelink=4358}


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;
      }
    }
  }
}

A Voir sur le même Sujet:

  • ajouter une exception dans java
  • ajouter exception java
  • ajouter des exceptions dans java

Leave a Reply

Your email address will not be published. Required fields are marked *