|
![]() |
Java Language Specification wrote:The informal intuition is that one method is more specific than another if any invocation handled by the first method could be passed on to the other one without a compile-time type error.
gurpeet singh wrote:where is method overloading happening ? you are saying out of 4 methods only one is present then how come overloading taking place ? Please be clear about the question so that other ranchers are able to understand what you want to convey
Henry Wong wrote:First, let me change your subject header -- your previous one just strikes me as too desperate. Not saying that you are, just mentioning that volunteers don't enjoying answering questions when there is a clock ticking (nor do they really care about that clock).
There are actually many reasons why a method is considered ambigious or not -- and most of them don't apply here. The one that does apply for this topic is related to the concept of "most specific" method. Here is the link to the Java Language Specification description of the rule...
http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.5
There is a ton of legalese verberage, even in this simple case (ignoring all the variable arity portions), but the phrase that seems to summarize it best is this one...
Java Language Specification wrote:The informal intuition is that one method is more specific than another if any invocation handled by the first method could be passed on to the other one without a compile-time type error.
Anyway, I can elaborate, and write up an example later, if you like. In the meantime, I will let you read it and take a shot at understanding it. It is actually not that bad. It just looks like giberish at first.
Henry
abhinas raj wrote:
sir please write an example and explain that for me ,i read the link , i coudnt understand properly . it was looking like i am studying mathematics.
Java Language Specification wrote:The informal intuition is that one method is more specific than another if any invocation handled by the first method could be passed on to the other one without a compile-time type error.
The types of the parameters of the first member method are T1, ..., Tn-1, Tn[].
The types of the parameters of the other method are U1, ..., Uk-1, Uk[].
If the second method is generic then let R1 ... Rp (p ≥ 1) be its type parameters, let Bl be the declared bound of Rl (1 ≤ l ≤ p), let A1 ... Ap be the type arguments inferred (§15.12.2.7) for this invocation under the initial constraints Ti << Ui (1 ≤ i ≤ k-1) and Ti << Uk (k ≤ i ≤ n), and let Si = Ui[R1=A1,...,Rp=Ap] (1 ≤ i ≤ k).
Ti << Uk (k ≤ i ≤ n), and let Si = Ui[R1=A1,...,Rp=Ap] (1 ≤ i ≤ k).
sakthi moorthy wrote:
not able to understand what the following equation says, can someone give me the idea.
Ti << Uk (k ≤ i ≤ n), and let Si = Ui[R1=A1,...,Rp=Ap] (1 ≤ i ≤ k).
keep an eye out for scorpions and black widows. But the tiny ads are safe.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|