As i know, in overriding we can't change the signature of the method. If will try to change, it will through a Compile time error.
So can anyone help me to understand why i am not getting error in below code.
As i know, in overriding we can't change the signature of the method. If will try to change, it will through a Compile time error.
So can anyone help me to understand why i am not getting error in below code.
Because you changed the parameter type your example is showing overloading, not overriding.
You can add the @Override
annotation to guard against accidental mistake like that:
@Override
public void testMethod(float b) {
}
will cause a compilation error.