+ 3
What is try and catch?♥️JAVA♥️
guys I am really want to know this two things although I know it's basic and also I have created little basic programming by this but according to you all people how it can be helpful or it work during making programming many of my friends say that it is very useful while making "games". What You People Say About It .
1 Respuesta
+ 3
Try and catch avoids crashing your program. Instead it allows you to handle an error for example showing an error message. A prime example is when you're opening and reading a file.
Let's say the file didn't exist and you tried opening it. Without catching the error, your program will crash ie. in Windows you'll get the classic program has stopped responding. However with try and catch, when the error occurs, you can choose what to do, for example showing a error dialog letting the user know the file doesn't exist.
Try and catch is useful in everything.