-, - . :
public class Parent {
public double getSum(double... value){
}
public double getAverage(int count){
double sum = getSum(20, 40, 60);
return sum / count;
}
}
public class Child extends Parent {
@Override
public int getSum(double... obj){
}
}
If you call the GetApid method of a child object, you will get an unexpected value, the entire interface of the Child object will be violated. You must also override the getAverage method ...
String class example
1462 public boolean startsWith(String prefix) {
1463 return startsWith(prefix, 0);
1464 }
from this point of view, it’s wrong, because the string is final, so you cannot inherit it and override its public methods.
source
share