About Question enthuware.ocajp.i.v7.2.1373 :
Posted: Thu Nov 14, 2013 12:33 pm
Hi there.
I was under impression that we look at reference class to see what methods we have access to but if the method in question is overridden in subclass, and actual object that reference referring to is of that subclass, then the overridden version of that method will be called.
Here though you say "2. Whether a call needs to be wrapped in a try/catch or whether the enclosing method requires a throws clause depends on the class of the reference and not the class of the actual object." - is that something that applies only in cases when throwing exceptions is involved?
I was under impression that we look at reference class to see what methods we have access to but if the method in question is overridden in subclass, and actual object that reference referring to is of that subclass, then the overridden version of that method will be called.
Here though you say "2. Whether a call needs to be wrapped in a try/catch or whether the enclosing method requires a throws clause depends on the class of the reference and not the class of the actual object." - is that something that applies only in cases when throwing exceptions is involved?