anuragk,
The way i usually think about compile time and runtime error is to figure out the information available to the compiler during compile time.
1. what about signature of method (when wrong, will give compile time or runtime error)
Lets look at an example
The compiler has all the information to conclude that there is not enough information to disambiguate the two methods. This error will be captured by the compiler.
trying to override a final method?
Same case. If a method has been tag with a final modifier, the compiler will immediately detect the error of trying to override it.
3.and in some cases when we implement rumtime polymorphism, it will also give compile time error
With polymorphism, sometime the type of an object could only be determined at run time.
Lets say int A is the user's input. There is no way the compiler could tell the type of o in advance. If A is not 1 then it will be a runtime error.
[ October 26, 2006: Message edited by: Syamsul Hussin ]