Utilisation de la classe d’exception ‘StackTrace’
By
java | Published:
13 October 2011

{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:
- c# ecrire stacktrace dans fichier text
- dom exception
- csharp exception personnalisé stacktrace