Once again I find myself super confused about the differences between these two kind of types: reference type and object type. For clarification, how I understand it now:
A).
reference type
1. left-side of declaration (the type of the variable)
2. static references --> never changes *
3. checked at compile time
4. can be interface-type
5. determines accessibility of fields and static methods
B).
object type
1. right-side of declaration (the object the variable is referring to)
2. runtime reference --> can change/be casted *
3. checked at runtime
4. is always a class (not interface)
5. determines accessibility of instance methods
So, in the answer mentioning "implementation of TYPE" I had above type B in my mind. Thus I was expecting an example with casting, where the type changes. What I meant with 'virtual method reference' was actually what is called 'virtual method invocation' on this page
https://docs.oracle.com/javase/tutorial ... phism.html.
But the example of the question did not do anything with
types but instead with method inheritance (and overriding), so I thought the correct answer was "Animal class illustrates Java's support for
multiple implementation inheritance.".
And Yes, I have read that. Multiple times. And to be honest I am trying to find logic and write an answer to your question for at least four hours now, but it just doesn't make (perfect) sense. I think my question comes down to this quote (from your linked page):
"The Java programming language supports multiple inheritance of
type, which is the ability of a class to implement more than one interface."
-> so WHAT TYPE is mentioned here? A or B? Or am I missing a third type?..
*About A.2 and B.2: what does not make sense to me between these lists now is that with casting the object itself (B) it always stays the same (Rice will be Rice, it doesn't become Food), but casting does change the reference type (A)..
please tell me there is a third type..?