GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Notizen

throwing our own exception

shanid m JAVA Englisch 1 Seite

Inhalt der Notizen (1)

Seite 1

Throwing our own exception

syntax:

throw new Throwble_Subclass

SAMPLE PROGRAM:

class MyException extends Exception

{

MyException(String msg)

{

super(msg);

}

}

class test

{

p.s.v.m()

{

int x=5,y=10;

}

try

{

float z=(float)x/(floaat)y;

if(z<0.01)

{

throw new MyException("number is too small");

}

}

catch(MyException e)

{

s.o.p("caught my exception");

s.o.p(e.getmessage());

}

finally

s.o.p("i'm always here");

}

}

}

Informationen

Beschreibung
JAVA Notiz am throwing our own exception, erstellt von shanid m am 13/10/2016.
Erstellt von
shanid m
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck