0

What will use exception in java

30th May 2024, 3:33 PM
Siddhesh mandhare
Siddhesh mandhare - avatar
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”.
30th May 2024, 4:34 PM
Kai Harrison