just doing round-table....!!
consider this code :
class A {
private static void staticMethod() {}
private final void finalMethod() {}
public void access() {
staticMethod();
finalMethod();
}
}
public class MyClass1 extends A{
void staticMethod() {} //will this compile ??
void finalMethod() {} //will this compile ??
public void access() {
super.access();
}
public static void main(
String[] args) {
MyClass1 a = new MyClass1();
a.access();
}
}
The above code will compiled without error, don't be confused with the
word static or final in class A, just pay attention on word private.
Since both method is declared private, it means it is not accessible outside the class in which it is defined, and thus a subclass can give it's own definition of methods which also happen to have the same signature as the methods in it's superclass.
but if the superclass method does not declared as private, then :
1. static method, can only be shadowed(not ovveride)with static method.
2. final method, can not be ovveride.
hope that helps
stevie