Jump to content

Need some help regarding questions

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
ahmed

ahmed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
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?

#2
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
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
Hreno

Hreno

    Newbie

  • Members
  • PipPip
  • 11 posts
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 {

     // 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.