UrbanPro

Learn Java Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Why is finally introduced in Java?

Asked by Last Modified  

21 Answers

Learn Java

Follow 0
Answer

Please enter your answer

Java Trainer

Finally is introduced in Java to do the code clean up or if you wants to perform some operation irrespective of whether the code throws an Exception or not.
Comments

Tutor

The finally block always executes, even if exceptions are not there. So, if you forget to write a requisite try or you want your program to end in a specified way, finally comes to play.
Comments

Java Trainer

end of the code executed.
Comments

Assuming that you mean "finally" that comes after try block: "finally" block is great place to free up resources, like DB connection, File etc. Finally is executed regardless of whether an exception occurs or not. Putting cleanup code in a finally block is always a good practice, even when no exceptions...
read more
Assuming that you mean "finally" that comes after try block: "finally" block is great place to free up resources, like DB connection, File etc. Finally is executed regardless of whether an exception occurs or not. Putting cleanup code in a finally block is always a good practice, even when no exceptions are anticipated. read less
Comments

Java Trainer with 6+ years of experience in big MNCs

finally is introduced to perform the cleanup operations such as closing the open DB connection clearing up the resources etc.
Comments

Java Web Application Development and Aptitude Trainer

Finally block helps you specify a block of code which you would want executed no matter if an exception arises or not.
Comments

Finally creates a block of code that will be executed after a try/catch block has completed and before the code following the try/catch block. The finally block will execute whether or not an exception is thrown. If an exception is thrown, the finally block will execute even if no catch statement matches...
read more
Finally creates a block of code that will be executed after a try/catch block has completed and before the code following the try/catch block. The finally block will execute whether or not an exception is thrown. If an exception is thrown, the finally block will execute even if no catch statement matches the exception. Besides exception handling, finally is also used in file closing and freeing up any other resources, when a method is about to return to the caller from inside try/catch block through a return statement and finally clause is executed just before methods returns. read less
Comments

Professional with 11 years of Java/J2EE SW development Industry experience.

Finally block in Java exception handling is a mechanism to write some clean-up activity code. Since 'finally' block code always executes it gives the programmer to do the clean-up activity even if the code in try block results in an unexpected exception. Also the finally code cannot be bypassed with...
read more
Finally block in Java exception handling is a mechanism to write some clean-up activity code. Since 'finally' block code always executes it gives the programmer to do the clean-up activity even if the code in try block results in an unexpected exception. Also the finally code cannot be bypassed with a 'break, return or continue'. Its a good practice to always include the finally block after try and catch. read less
Comments

Senior Software Engineer

it depends on whether you can deal with the exceptions that can be raised at this point or not. If you can handle the exceptions locally you should, and it is better to handle the error as close to where it is raised as possible. If you can't handle them locally then just having a try / finally block...
read more
it depends on whether you can deal with the exceptions that can be raised at this point or not. If you can handle the exceptions locally you should, and it is better to handle the error as close to where it is raised as possible. If you can't handle them locally then just having a try / finally block is perfectly reasonable - assuming there's some code you need to execute regardless of whether the method succeeded or not. read less
Comments

Senior Software Engineer

t depends on whether you can deal with the exceptions that can be raised at this point or not. If you can handle the exceptions locally you should, and it is better to handle the error as close to where it is raised as possible. If you can't handle them locally then just having a try / finally...
read more
t depends on whether you can deal with the exceptions that can be raised at this point or not. If you can handle the exceptions locally you should, and it is better to handle the error as close to where it is raised as possible. If you can't handle them locally then just having a try / finally block is perfectly reasonable - assuming there's some code you need to execute regardless of whether the method succeeded or not. read less
Comments

View 19 more Answers

Related Questions

Which language has the best future prospects: Python, Java, or JavaScript?
According to me, "Python" is the programming language having the best future prospect considering the current industry trend. Reason: Python is extensively used in advanced technologies such as Machine...
Atharva
0 0
5
Why do many software engineers not like Java?
Opinions on programming languages can vary, but some software engineers may express dissatisfaction with Java for reasons such as perceived verbosity, boilerplate code, and a slower pace of language evolution...
Guruprasad
0 0
5
What is a complete list of topics of Core Java and topics of Advanced Java?
Core Java I. Introduction 1. Why Java 2. Paradigms 3. Diff b/w Java & Other (C,C++) 4. Java history 5. Java features 6. Java programming format 7. Java Tokens 8. Java...
Chandramami
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Be prepared to get trained--init
Before starting the training,students must be mentally prepared for acceptance of new knowledge. Students must attend training with open minded forgetting the position they are working.This will help...
S

Smartnub Softsolutions

0 0
0

Easy way to remember Java keyword.
ACCESS MODIFIER ACCESS SPECIFIER abstract, assert, const, final, native, static, strictfp, super, synchronized, this, transient, void, volatile public, private, protected, default DATA...

Rohit Deshbhratar

1 0
0

Overview on Auto IT and use in selenium webdriver
AutoIt v3 is a freeware BASIC-like scripting languages designed for automating the windows GUI and general scripting. It used a combination of simulated keystrokes, mouse movements and window/control manipulation...
S

Constructor in Java
A constructor is a particular type of method that is used to initialise the object. The constructor is invoked at the time of object creation. It constructs the values, i.e. provides data for the object...

Simple Input and Output in CoreJava
We can use any of the following options based on the requirements to accept data from the user in corejava and show them Integer Input Output Character Input Output Float Input Output INPUT AND...

Recommended Articles

Before we start on the importance of learning JavaScript, let’s start with a short introduction on the topic. JavaScript is the most popular programming language in the world, precisely it is the language - for Computers, the Web, Servers, Smart Phone, Laptops, Mobiles, Tablets and more. And if you are a beginner or planning...

Read full article >

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”.  Right from its first implication as java 1.0...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Training with the Best Tutors

The best Tutors for Java Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more