throw the exception but continue the flow?

Discussion in 'Java' started by Steve, May 1, 2008.

  1. Steve

    Steve Guest

    When it throws the exception, how to not stop the program but keep
    continue?

    When I get this exception, it stops and cannot continue.

    Exception in thread "main" java.io.FileNotFoundException:
    at
    sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
    rce)

    please help. thanks
     
    Steve, May 1, 2008
    #1
    1. Advertising

  2. Steve wrote:
    > When it throws the exception, how to not stop the program but keep
    > continue?
    >
    > When I get this exception, it stops and cannot continue.
    >
    > Exception in thread "main" java.io.FileNotFoundException:
    > at
    > sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
    > rce)
    >
    > please help. thanks


    try {
    // put your code here that can throw the exception below in the
    // catch part of this structure
    } catch (FileNotFoundException e) {
    // code here to clean up from your exception
    }
    // next sequential instruction

    --

    Knute Johnson
    email s/nospam/linux/

    --
    Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
    ------->>>>>>http://www.NewsDemon.com<<<<<<------
    Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
     
    Knute Johnson, May 1, 2008
    #2
    1. Advertising

  3. Steve wrote:
    > When it throws the exception, how to not stop the program but keep
    > continue?
    >
    > When I get this exception, it stops and cannot continue.
    >
    > Exception in thread "main" java.io.FileNotFoundException: at
    > sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
    > rce)
    >
    > please help. thanks


    Reade the manual about try/catch. It's used to detect and handle exception.

    Regards,
    Leonard

    --
    Simplicity is the ultimate sophistication.
    -- Leonardo da Vinci
     
    Leonard Milcin, May 1, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kerri
    Replies:
    2
    Views:
    13,116
    Kevin Spencer
    Oct 27, 2003
  2. Replies:
    15
    Views:
    7,760
    Roedy Green
    Sep 8, 2005
  3. Shawn
    Replies:
    2
    Views:
    292
  4. Shawn
    Replies:
    3
    Views:
    347
    Oliver Wong
    Nov 29, 2006
  5. Jack Dowson
    Replies:
    0
    Views:
    479
    Jack Dowson
    May 7, 2007
Loading...

Share This Page