Hi Vlad,
The following is the code which could explain u the concept that private methods could not be overriden.
class overridePrivateClass
{
int data;
private void func()
{
System.out.println(data);
}
}
class derivedClass extends overridePrivateClass
{
void func()
{
System.out.println(super.data);
}
}
class overridePrivate
{
public static void main(
String [] args)
{
derivedClass ob = new derivedClass();
ob.func();
}
}
Here, overridePrivateClass has got a private method func.
From the code u might say that in the derived class " derivedClass"
the function func has been overriden, but actually the function is
not overriden in derivedClass. The func in overridePrivateClass is
not vissible in derivedClass, since it is declared private.
And when u enter in derivedClass , the is no definition for func and
so we could write our own code for that function.
I hope it could help u.
Arnab