Java programmeerimise konspekt
s = sisse.readLine();
m = Integer.parseInt (s);
if (m<0)
throw new IllegalArgumentException
(String.valueOf (m));
System.out.println ("Igale lapsele "
+ String.valueOf (m/n) + " 6una
ja "
+ String.valueOf (m%n) + " j22b
yle");
}
catch (ArithmeticException e) {
System.out.println ("Aritmeetikakatkestus:
" + e.toString());
}
catch (Exception muu) {
System.out.println ("Probleem: " +
muu.toString());
}
finally { // see t2idetakse igal juhul
System.out.println ("n = " + n + " m = "
+ m);
}
} // while
} // main
} // Erind
/** A small example about catching
NumberFormatException.
* @author Jaanus Poial
* @version 0.2
*/
public class ExceptionUsage {