+ 2
Can anyone explain exception handling in Java or any reference?
2 odpowiedzi
+ 6
During the execution of a program if any unwanted or unexpected error comes that is called an exception. It means if anything happens wrong during the execution of a program and disrupts the normal flow of the program’s instructions is called an exception. Exceptions may occur for different reasons:
If the user has entered the wrong data. Like user is trying to divide any value by 0 e.g. 5/0.
If the user tries to open a file with an invalid name.
If a user tries to access an array with a negative index value.
If a user tries to print a page but the printer doesn’t find it.
Real-life example: Let’s take an example of a courier company. If I am sending a gift to my friend but due to some reason the courier company is failed to deliver. That is called exception because this is an unexpected thing happened during normal delivery of our product. If a company handling these types of problem and send a notification to me.
https://javagoal.com/exception-handling-in-java/
+ 4
click this link:
https://stackify.com/specify-handle-exceptions-java/