G
Gästestuhl
Gast
Hallo,
ist es richtig wenn man 2 verscheiedene Exceptions in einer Methode hat?
Beispiel:
ist es richtig wenn man 2 verscheiedene Exceptions in einer Methode hat?
Beispiel:
Java:
public void insert(Element x, int n) throws IllegalArgumentException {
if (frei < max) {
if (n < 1 || n > frei + 1) {
throw new IllegalArgumentException("Außerhalb der Liste");
}
for (int i = frei; i >= n; --i) {
a[i] = a[i-1];
}
a[n-1] = x;
frei++;
}
else
throw new IllegalArgumentException("Die Liste ist voll");
}