Home arrow static arrow Java Programming [Archive] - doubt regarding overridding in Java ....
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - doubt regarding overridding in Java ....
This topic has 2 replies on 1 page.

Posts:13
Registered: 2/6/01
doubt regarding overridding in Java ....  
Jul 17, 2004 4:42 AM



 
Dear Friends,

I have some doubt in Over ridding ......

Ex :

class A {
private void Test(){
System.out.println ("Test from A");
}
}

class B extends A {
private void Test(){
System.out.println ("Test from B");
}
}

as per the overridding rule

1. sub class should have same method signature as in the base class
2. sub class should not define a method more private

as per the rule in the above class is overridding happen ??? since i have defined a method called Test() in both class with same signatrue ???

another questions is

interface A {
public void Test();
}

interface B extends A {
public void Test();
}
}

in this context is overridding happening ????

plz explain me,

Thanks a lot in Advance.

 

Posts:6,750
Registered: 1/25/04
Re: doubt regarding overridding in Java ....  
Jul 19, 2004 8:15 AM (reply 1 of 2)



 
as per the rule in the above class is overridding
happen ??? since i have defined a method called Test()
in both class with same signatrue ???

No, private methods cannot be overridden.

in this context is overridding happening ????

No, because there is no implementation to be overridden. You're just uselessly specifying the method in both interfaces.
 

Posts:24,036
Registered: 2/3/03
Re: doubt regarding overridding in Java ....  
Jul 19, 2004 8:17 AM (reply 2 of 2)



 
plz explain me

[url=http://www.postdirekt.de/plz_suche/]PLZ information[/url]
 
This topic has 2 replies on 1 page.