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 8779217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:43:53+00:00 2026-06-13T19:43:53+00:00

Well here I’ve seen this in API and other related questions: try { }

  • 0

Well here I’ve seen this in API and other related questions:

try {

} catch (IOException e) {
    throw new SampleException("Other IOException", e);
}

Which calls a new exception.

But now I have seen this example which calls itself. I’m trying to write the documentation and it seems it calls itself again.

try {
    statements;
}catch(TheException e) {
    //perform operations before exits;
    throw e; 
}

Re-throwing the exception so that other handlers get a chance to
process the exception

I guess we can not add one more TheException after our catch exception! So in this case who is the other handler? I tested it and I realize even codes after catch clause are not compiled!

  • 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-13T19:43:55+00:00Added an answer on June 13, 2026 at 7:43 pm

    Let’s say you have two methods.

    First one:

    public void methodA() throws IOException {
    
        try {
    
            // methodWhichCanThrowIOException();
    
        } catch (IOException e) {
    
            // //perform operations before exits;
            throw e;
        }
    }
    

    Second one:

    public void methodB() {
    
        try {
    
            methodA();
    
        } catch (IOException e) {
    
            // //perform operations;
        }
    }
    

    See how method B calls method A. The exception raised originally inside method A is handler by method A itself, but once this is done, method A decides to throw the exception so other handlers get a chance to process the exception. Other hander as method A. Notice that method A can be in a different class, in a different layer.

    For method A, throwing an exception is a nice way to inform method B that something happened.

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

Sidebar

Related Questions

Extreme Android developer newbie here...well, new to Android development, not development in general. I
Well i need some help here i don't know how to solve this problem.
Well, I read several issues (here and other sites) about class level validation with
If the title wasn't clear, ill try to explain it well here. I have
well here is the thing, i have this print using php: echo '<a href='.$npeurl.'><img
Well here is the API I'm trying to use: http://www.hotelscombined.com/api/LiveRates.asmx?op=HotelSearch Here is the code
Well here is the shutdown method public static void restart() { closeServices(); System.gc(); try
I have some code like this, well here is the part that is most
Well here is the situation, from the table before I running this code is
I get this error, when try to create new action for UIButton by dragging

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.