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

Notizen

Ohne Titel

Amanda McCauley Englisch 1 Seite

Inhalt der Notizen (1)

Seite 1

Exception handling

•An

exception is an event that occurs during the execution of the program that

disturbs the normal flow of instructions.

e.g. An invalid data type has been entered, accessing an array with an index that is too large/small, opening a file that cannot be found etc.

When exceptions happen the usual result is a crash.... unless they are handled.

•There

are two aspects of dealing with program errors:

Detection: Identify

the type of problem.

Handling: Handle

the problem to avoid crash/other issues.

Java has 'exception classes' which deal with all the different exceptions.

IOExceptions, ClassNotFoundExceptions, RuntimeException

•Exception handling operates by:

Trying to run a procedure that might cause

an error then having

a method that Catches an error condition and “throws an exception”.

If

you write a segment of code in which something might go wrong then you can

place it in a try block:try {

//the

statements that might result in

//an exception

} catch (Exception anException) {

//action to

take if exception occurs

}

Informationen

Beschreibung
Notiz am Ohne Titel, erstellt von Amanda McCauley am 20/03/2017.
Erstellt von
Amanda McCauley
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck