Skip to main content

Shadowing

In short, it occurs, when the same variable name is present in the parent scope. So, local variable hides the variable present in parent scope.

Field shadowing

It occurrs when we declare a member in sub-class with the same name as the member in super-class.

Method shadowing

It occurrs when we declare a method in sub-class with the same name as the method in super-class.