Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the cause of "Syntax error, insert "Finally" to complete TryStatement"

Tags:

java

try-catch

I'm using eclipse to create an android application that gets a list of all the currently displayed apps on the phone but I am getting an error that I've never seen before. My code looks right but at one of the "}" brackets im getting the error "Syntax error, insert "Finally" to complete TryStatement", does anyone know how to solve this error?

Thank you.

like image 596
Hip Hip Array Avatar asked Mar 22 '11 14:03

Hip Hip Array


1 Answers

You need to either have a "catch" clause or a "finally" to accompany your try:

try {
    // ... something dangerous ...
} catch(IOException e) {
    // ... handle errors ...
} finally {
    // ... cleanup that will execute whether or not an error occurred ...
}
like image 187
Matthew Willis Avatar answered Oct 07 '22 17:10

Matthew Willis