+ 1
Do you know Exception Handling?
i don't know
2 Answers
+ 1
You can catch exceptions in Java with:
try {
// all the code where the exception could happen and you want to catch it
} except (Exception e) {
// what you want to execute when the exception actually happens
}
Notice how I put Exception after except. Exception class is the base class of all exceptions. The above will catch any exception.
If you wanted to (for example) catch FileNotFoundException, you would put that instead of Exception above.
+ 1
tanks master