I know its via inheritance when we say B c = new C(); but what is the difference with C c = new C()
I know this code works but the why and how is my epidemic. when I did my own math (using pen and paper) it gave me 80. But when I read through the OCA paper I noticed they arrived at the same answer but for different reasons.
"When the program is run, the main() method will call the max() method in C with parameters 10 and 20 because the actual object referenced by 'c' is of class C. This method will call the max() method in B with the parameters 20 and 40. The max() method in B will in turn call the max() method in A with the parameters 20 and 40. The max() method in A will return 40 to the max() method in B. The max() method in B will return 80 to the max() method in C. And finally the max() of C will return 80 in main() which will be printed out."
Which sounds more or less Greek to me, please help. Wanna know what it means to write B c = new C(); and how it differs to C c = new C();