+ 2
Plz explain about try catch
in java
1 Odpowiedź
+ 1
a try catch is a technique that manage or handles errors such as invalid input, files, images, database and other types of error that occurs during run time.
example in java:
try{
age = 99;
if(age > 99 || age < 1) {
throw new Exception();
}
} catch (NumberFormatException e) {
//catches error message if input is not a number
} catch(Exception e){
//catches error message for general type of error
}