Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void testaaArvo(int i) throws PieniPoikkeus, SuuriPoikkeus {
- if (i < 5) {
- throw new PieniPoikkeus("Arvo oli alle 5.");
- } else if (i > 10) {
- throw new SuuriPoikkeus("Arvo oli yli 10.");
- }
- }
- public static void tulostaVirheTeksti(Exception e) {
- System.out.println(e.getMessage());
- }
- }
- class PieniPoikkeus extends Exception {
- public PieniPoikkeus(String msg) {
- super(msg);
- }
- }
- class SuuriPoikkeus extends Exception {
- public SuuriPoikkeus(String msg) {
- super(msg);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement