Héritage avec vos propres exceptions

Author:


Download

public class TesterMonException {
 
  public void a() throws MonException { //Utilisation de ma classe
    System.out.println("Jeter l'exception");
    throw new MonException();
  }
 
  public static void main(String[] args) {
    TesterMonException sed = new TesterMonException();
    try {
      sed.a();
    } catch (MonException e) {
      System.err.println("Attraper l'exception");
    }
  }
}
//Cr�ation de ma propre classe d'exception
class MonException extends Exception
{
 
}