Ausnahmen (Exceptions)

Ausführung einer Anweisung kann fehlschlagen (Exception auslösen), Exception kann behandelt werden:

String c = input.getText();
try {
    int i = Integer.parseInt(c);
    result.setText(Integer.toString(i * i));
} catch (Exception ex) {
    result.setText(ex.toString());
} finally {
    doLayout(); 
}



Johannes Waldmann 2006-01-26