0

wanna more details in Exception ?

17th Jun 2017, 9:18 AM
aya mesameh
aya mesameh - avatar
1 Resposta
0
yes? lol idk what u mean by this but... exceptions are pretty cool. instead of your program pooping its pants, you throw an exception and it runs to the bathroom and the toilet catches the exception. this way nothing bad happens. there are ALOT of exceptions in java but two main categories Runtime and (something else I forgot...) u can use these exceptions anywhere for anything Ex: u have a menu driven program. all options are stored in an array the user is to type in an option (I.e. index) you would TRY to index with the user input. hopefully nothing goes wrong but if ut does you can CATCH an arrayIndexOutOfBoundsException or whatever it is. in this catch phase instead of loadinf the array info print out to enter a valid number. there are tons of things to do with exceptions. hope this helps. if you would like to learn how to throw them id be more than happy to teach!
18th Jun 2017, 5:46 AM
Michael Szczepanski
Michael Szczepanski - avatar