0
What will use exception in java
1 ответ
+ 2
A good use case to help your understanding of the application of exceptions is that you’re creating a library (or collection of code) where there’s a function that sends a HTTP request in order to receive information on some cats.
It is important that the library developer throws an exception if the connection is refused.
It is equally important that the developer CATCHES the exception so that they execute fallback code like displaying a picture of a sad cat with the label “unable to connect”.