Can anyone help me out with these questions related to exceptions?What types are throw able and which types are not and name some that are not and reason?
Need some help regarding questions
Started by ahmed, Oct 30 2009 06:09 AM
2 replies to this topic
#1
Posted 30 October 2009 - 06:09 AM
|
|
|
#2
Posted 01 November 2009 - 06:10 AM
Please read the Java Trail on Exceptions, that's a good place to start. You can throw any object that is derived from the Exception class in Java.
Wow I changed my sig!
#3
Posted 01 November 2009 - 08:13 AM
Shortly: You use exceptions to handle 'unexpected' problems, that happen in a block of code that you try to execute.
This is how you do it:
'try' is executed first. If an exception occurs inside of 'try', program will execute 'catch'. 'finally' is always executed, no matter if exception occurs or not.
For more, read the upper link.
This is how you do it:
try {
// your code you want to handle
} catch (Exception e) {
// print/log/fix exception
} finally {
// this is always executed
}
'try' is executed first. If an exception occurs inside of 'try', program will execute 'catch'. 'finally' is always executed, no matter if exception occurs or not.
For more, read the upper link.


Sign In
Create Account


Back to top









