Yes. For example, if you were trying to ‘catch’ an InvalidYearException
, you would do something like this:
try {
// Your code (the code that will possibly cause an exception to be thrown)
} catch(InvalidYearException exception) {
// Your code (the code that will be executed when you 'catch' an InvalidYearException)
// for example:
System.out.println("Error!" + exception.getMessage());
}
0
solved Java Array Search, on a value which i’snt inside the array Exception Error