Professional Documents
Culture Documents
Eleventh
Eleventh
&
Exception Handling
• If you’re inside a method and you throw an exception (or another method you call within this
method throws an exception), that method will exit in the process of throwing. If you don’t
want a throw to exit the method, you can set up a special block within that method to
capture the exception. This is called the try block because you “try” your various method calls
there. The try block is an ordinary scope preceded by the keyword try.
• try {
• // Code that might generate exceptions
• } catch ()
• {
• // Code of catching the exception }
التقاط االستثناءات
الخرج