+ 2

Plz explain about try catch

in java

28th Sep 2017, 12:29 AM
Abinesh N
Abinesh N - avatar
2 Answers
+ 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 }
28th Sep 2017, 3:00 AM
vincent
vincent - avatar