How can the caller of clone()
possibly recover if they encounter a CloneNotSupportedException ? Why is it a checked Exception ?
Why is it a checked Exception?
I suspect the answer is really: "because when Java first came out, there was very little experience of when it would make sense for an exception to be checked." Back then, they didn't have Effective Java :)
There are various things like this - exceptions which are checked but probably shouldn't be, and occasions where the exception is unchecked but should be checked... Integer.parseInt
throwing NumberFormatException
probably being the clearest example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With