On Mar 14, 12:08 pm, durgaapparao...@gmail.com wrote:
> hello sir,
>
[quoted text clipped - 36 lines]
> with regards
> Appu
method name can be same but method signature have to be different to
coexist.
Change one of the dis by adding parameter to it.
Eg:-
void dis() {
// do something
}
static void dis(String parm){
// do something else
}
--
Ck
http://www.gfour.net
Lew - 14 Mar 2007 14:30 GMT
durgaapparao...@gmail.com wrote:
>> hello sir,
>> class SameName {
[quoted text clipped - 8 lines]
>> void dis() {
>> S.o.p("This is Instance method");
What is 'S.o.p'? I see no definition.
Please provide SSCCEs.
>> }
>>
>> static void dis() {
>> S.o.p("This is Static method");
Consider indenting code by a few spaces as suggested by the Sun Java coding
conventions (Sun, 1999) and nearly universally practiced.
>> }
>>
[quoted text clipped - 6 lines]
>> }
>> }
ck answered your main question. The compiler resolves method signatures first,
'static' and other qualifiers after. Two methods with the same name in the
same class must have different signatures (overloading).
-- Lew