|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
RE: Exceptions in finally
Posted by Kishori Sharan on August 28, 2000 at 4:22 PM
Hi You can put your code in finally block within a try block and handle the exceptions there in corresponding catch block. Thanx Kishori ////////////////Test.java///////////////////////// class Test { public static void abc ( ) throws Exception { try { throw new Exception ( "From first try" ) ; } catch ( Exception e ) { throw e ; } finally { try { throw new Exception (" From finally") ; } catch ( Exception e ) { throw e ; } } } public static void main ( String[] args ) { try { abc ( ) ; } catch ( Exception e ) { System.out.println ( e.getMessage ( ) ) ; } } }
Replies:
|