# 5.6) What happens if both a catch and a finally block define return statement?

![](/files/-La_2HmvXwZkloS8s9Ay)

![](/files/-La_2MWfKum8a0kceY_S)

```java
public class MultipleReturn {
	int getInt() {
		try {
			String[] students = { "Harry", "Paul" };
			System.out.println(students[5]);
		} catch (Exception e) {
			return 10;
		} finally {
			return 20;
		}
	}
}
```

```java
public class TestMultipleReturn {
	public static void main(String[] args) {
		MultipleReturn var = new MultipleReturn();
		System.out.println(var.getInt());
	}
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gyansetu-core-java-for-java.gitbook.io/project/exception-handling/4-what-happens-when-an-exception-is-thrown/what-happens-if-both-a-catch-and-a-finally-block-define-return-statement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
