import java.applet.Applet; import java.awt.Graphics; // Luodaan oma poikkeusluokkaa class Omapoikkeus extends Exception { } public class Poikkeus1 extends Applet { public void paint (Graphics x) { String jono = "Heippa"; try { if (jono == "Heippa") throw new Omapoikkeus(); } catch (ArithmeticException a) { x.drawString("VIRHE : Nollalla jako !!!",20,30); } catch (Omapoikkeus o) { x.drawString("VIRHE : Se oli se oma poikkeustilanne !!!",20,30); } catch (Exception e) { x.drawString("VIRHE : JOku muu virhe !!!",20,30); } } }