Utilisation de la classe d’exception ‘StackTrace’

Author:


{filelink=4346}

public class StackTrace {

  IllegalArgumentException ex;

  public static void main(String[] argv) {
    StackTrace st = new StackTrace();
    st.provoquerException();
    System.out.println("L'exception est construite");
    st.ex.printStackTrace();
    st.generer();
    System.out.println("L'exception est construite mais ");
    st.ex.printStackTrace();
  }

  public void provoquerException() {
    ex = new IllegalArgumentException("Argument pour générer l'exception");
  }
  public void generer() throws IllegalArgumentException {
    throw ex;
  }
}

A Voir sur le même Sujet:

  • csharp exception personnalisé stacktrace
  • dom exception
  • c# ecrire stacktrace dans fichier text

Leave a Reply

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