Java programmeerimise konspekt
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 {
/** Main method gets an integer parameter from the
command line.
* If the parameter is not a number or if it is not
in between 1 and 99
* an IllegalArgumentException is thrown.
*/