This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065)
By: Kathy Sierra; Bert Bates
Print ISBN-10: 0-071-59106-0
I am on Chapter 2, Overriding / Overloading (Exam Objectives 1.5 and 5.4). From what I understand, OVERLOADED methods are invoked based on the information received by compiler at compile time, while OVERRIDDEN methods are invoked based on information received by JVM at runtime. What is the LOGIC behind this design, why isn't it vice versa, i.e. OVERLOADED methods invoked at runtime, OVERRIDEN methods invoked based on information received by compiler.
The compiler does not check for everything at the compile time only
means the checking is superficial and compiler does not know what will happen at run time
At compile time , the type of the object is checked and at the run time the object is checked
Which overloaded method to be called is decided at the compile time
Which overriden method to be called is decided at the run time
To make things clearer
you can take a look at the following code
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right