Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8410431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:10:27+00:00 2026-06-10T00:10:27+00:00

I am very confused as to why do I need to need to put

  • 0

I am very confused as to why do I need to need to put the clean-up code like closing streams in a finally block.

I’ve read that the code in finally block will run no matter what (whether there’s an exception); and after the finally block runs, the rest of the method continues.

My question is: if the rest of the method has to continue then why don’t I put the clean-up code after my try/catch block in a function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:10:29+00:00Added an answer on June 10, 2026 at 12:10 am

    The finally block will always run if an uncaught exception is thrown, but the rest of the code in the method will be skipped.

    So if you put clean-up code after the finally block, it won’t get called if there is an exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the docs and everything but I'm very confused. I never needed
I am very confused by the name 'unordered_map'. The name suggests that the keys
I am learning cakePHP, everything seems alright except that I am very confused of
I am just very confused by this conflicting thing. I do want to put
I am still very confused on how to use _.bindAll() . I understand that
I'm very confused in creating Tables in MySQL because I read some PHP tutorials
I'm very confused which one I need to use for grep object between up()
I would like to calculate distance between two groups. I am very confused. I
I need to create a constructor that creates an account. It will ask the
I get very confused when it comes up to byte conversation. I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.