I am new to JAVA i am preparing for my OCP JP certification.
I have this doubt regarding exception handling
try{
assert(false):"HI";
}
catch(Throwable e){}
I know assert should not be handled but i am using this just for example. From what i know Object->Throwable ->Exception and Error
If i have Throwable or Exception or Error in the catch block it works but when i have object which is super class of all, eclipse shows me a compile time error.
Any reason why i cant have Object in catch block?

Only objects of type
Throwablecan be thrown or caught (which includesExceptionandError) in Java.So it would be worthless to catch any old
Object, because onlyThrowables can be thrown.Quoting from the JLS, Section 14.20: