Reputation: 17
From my research on google, most sites say that "Throwable" is the ultimate superclass for Exceptions. I accept it, but even when Throwable is a sub-class of Object class why I can't able to store exceptions under Object class?
https://i.sstatic.net/3EZsz.jpg
Upvotes: 0
Views: 44
Reputation: 1132
You can't throw an arbitrary object because the language says you can't: JLS 14.18
You can't catch an arbitrary object because the language says you can't: JLS 14.20
The intent is to restrict exception objects to a particular hierarchy.
Upvotes: 3