[HD-OCP17/21-Fundamentals Pg 166, Sec. 6.4.4 - instance-initializers-vs-constructors]
Posted: Thu Sep 19, 2024 11:24 pm
hello
why is this instance initializer correct ?? and compile fine??
because if i put this code inside main then compiler will complain and its logic because subtype cannot catch superclass!!
why is this instance initializer correct ?? and compile fine??
Code: Select all
{
try {
throw new Exception();
} catch (RuntimeException e){
}
}