> For the complete documentation index, see [llms.txt](https://gyansetu-core-java-for-java.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gyansetu-core-java-for-java.gitbook.io/project/exception-handling/4-what-happens-when-an-exception-is-thrown/5.5-will-a-finally-block-execute-even-if-the-catch-block-defines-a-return-statement.md).

# 5.5) Will a finally block execute even if the catch block defines a return statement?

![](/files/-La_-U0yUFeNSiCspRL2)

![](/files/-La_-d_YIyICqZNOepVb)

#### Example:

```java
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class ReturnFromCatchBlock {
	public static void main(String[] args) {
		openFile();
	}

	private static void openFile() {
		FileInputStream fis = null;
		try {
			fis = new FileInputStream("file.txt");
		} catch (FileNotFoundException fnfe) {
			System.out.println("file not found");
			return;
		} finally {
			System.out.println("finally");
		}
		System.out.println("Next task..");

	}
}
```

![](/files/-La_0d1yd-VG_t-A-a3D)

![](/files/-La_0lTLUJ21SOKaFLpP)

![](/files/-La_0plrQdHTTwFPkcKH)
