Because if an exception gets thrown no code after the try
block is executed unless the exception is caught. A finally
block is always executed no matter what happens inside your try
block.
More Related Contents:
- Does a finally block always get executed in Java?
- Returning from a finally block in Java
- How does Java’s System.exit() work with try/catch/finally blocks? [duplicate]
- Can we use “return” in finally block [duplicate]
- Java Try Catch Finally blocks without Catch
- Behaviour of return statement in catch and finally
- What are the circumstances under which a finally {} block will NOT execute?
- Try-catch-finally and then again a try catch
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- How do I get the CellRow when there is an ItemEvent in the JComboBox within the cell
- Difference between FetchType LAZY and EAGER in Java Persistence API?
- How do you import classes in JSP?
- Difference between java HH:mm and hh:mm on SimpleDateFormat
- How to hash some string with sha256 in Java?
- Firebase No properties to serialize found on class
- How returns XxxSize from JComponent(s) added to the JLabel
- Difference between @Valid and @Validated in Spring
- Select random document from Firestore
- JSONParser from androidhive tutorial, NoSuchMethodError in DefaultHttpClient
- Get first date of current month in java
- How can I update a broadcast variable in spark streaming?
- How to force java server to accept only tls 1.2 and reject tls 1.0 and tls 1.1 connections
- understanding basic recursion
- Java BitSet Example
- Is it possible in java make something like Comparator but for implementing custom equals() and hashCode()
- Hibernate: Create Mysql InnoDB tables instead of MyISAM
- Writing a new refactoring plugin for Eclipse?
- Difference between @MapKey, @MapKeyColumn and @MapKeyJoinColumn in JPA and Hibernate
- Eclipse: change name of existing package with classes inside
- How to modify request body before reaching controller in spring boot