java - try catch specifics -
When I try to use a try / grip then what type of errors do I try and get confused I have seen the comment on not recommending the use of
hold (exception e) to do research here in Stack Overflow because it is normal , But where I can see the particular errors, I should look for an example, Try the code (try to play audio file) hold (invalid file) hold (bad connection) hold (file not found) hold (invalid file size) etc.
Above the pseudo errors I cover a wide range of Internet connectivity functionality to file specific catalogs.
How can I cover all these cases?
I have an app that shows a message that says that the file can not be played, but to catch specific error And every time I see this message. May appear and correct it.
What if I would like to try and catch an error for something which I coded myself?
This may be a bad example, but if I I want to calculate the period of planetary orbit and generate error if the period is smaller than some value. The values used should be more than 13 months, but due to some unknown reasons, some may be below 13 due to some reasons and I have to find out why I use a try catch because something is wrong and not me Know what it is, maybe I should use the full value of a number instead of numbers or something similar was the main thing that I do not know what caused the error.
You can catch specific errors to catch a special type:
try {... file open ...} catch (IOException E) {... IO exception handling ...} one exception Exceptions are arranged in a hierarchy, so some leave the others, for example, is the subclass of IOException , so if you have any IO errors (EOF errors Including) if you want to capture only EOF specifically, use EOFException then use IOException . You can write your own exception (or one of its subclasses), and hold it is like any other predefined exception.
Comments
Post a Comment