Play audio slide show -- Keyboard shortcut: 'x'  Lecture overview -- Keyboard shortcut: 'u'  Previous page: Finally i Java's try blok (1) -- Keyboard shortcut: 'p'  Next page: Erklæring af exceptions i metoder -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home  Play sound for this slide -- Keyboard shortcut: 'y'    Undtagelseshåndtering - slide 20 : 26

Finally i forhold til return, break og continue 

Der er ingen mulighed for at forlade en 'try blok' uden at udføre 'finally blokken'

Specielt kan Java's hop kommandoer break, continue og return ikke komme uden om en 'finally blok'

 

FindLetterInFile.javaIllustration af finally i forhold til return: Læsning af en fil indtil et bestemt tegn mødes.
 

FinallyBreak.javaIllustration af finally i forhold til break.
 

FinallyBreakOutputOutput af ovenstående program.
 

FinallyContinue.javaIllustration af finally i forhold til continue.
 

FinallyContinueOutputOutput af ovenstående program.
 

 

Det giver mening at have en try-finally konstruktion uden catches