If your method has the same name that the parent’s, parameters and return type, you’re overriding it.
Also you can add @Override
annotation on the top of your method.
Always check parent’s method is not final nor private.
For instance
public class Parent{
public void method(String param){
//Do stuff
}
private void notExtendable(String param){
}
protected void alsoExtendable(String param){
}
}
public class SubClass extends Parent{
@Override
public void method(String param){
//super.method() //if you want to execute parent's method
//Do your own stuff
}
}
You have all information you need here: http://docs.oracle.com/javase/tutorial/java/IandI/override.html
solved How do I override a parent class’s method? [closed]