SCJP 1.4 (90%), SCWCD 1.4 (92%)
SCJP 1.4 (90%), SCWCD 1.4 (92%)
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
SCJP 1.4 (90%), SCWCD 1.4 (92%)
From Section 15.12.2.2
Let m be a name and suppose that there are two declarations of methods named m, each having n parameters. Suppose that one declaration appears within a class or interface T and that the types of the parameters are T1, . . . , Tn; suppose moreover that the other declaration appears within a class or interface U and that the types of the parameters are U1, . . . , Un. Then the method m declared in T is more specific than the method m declared in U if and only if both of the following are true:
* T can be converted to U by method invocation conversion.
* Tj can be converted to Uj by method invocation conversion, for all j from 1 to n.
...
From Section 5.3
Method invocation [conversion] allows the use of an identity conversion, a widening primitive conversion, or a widening reference conversion.
...
Also from Section 5.3
Method invocation conversions specifically do not include the implicit narrowing of integer constants which is part of assignment conversion.
Mike Gershman
SCJP 1.4, SCWCD in process
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
Are you using Java 1.4 to test this?
Let m be a name and suppose that there are two member methods named m, each having n parameters. Suppose that the types of the parameters of one member method are T1, . . . , Tn; suppose moreover that the types of the parameters of the other method are U1, . . . , Un. Then the first member method is more specific than other if and only if Tj can be converted to Uj by method invocation conversion, for all j from 1 to n. A method is strictly more specific than another if and only if it is both more specific and the signatures of the two methods are not identical.
Mike Gershman
SCJP 1.4, SCWCD in process
I am using j2sdk1.4.2_06 and I do not get any errors . I get the same output as Barry mentioned.
Mike Gershman
SCJP 1.4, SCWCD in process
All of the following truths are shameless lies. But what about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|