Variable shadowing
07/07/2012 1 Comment
Today we’ll look into a rare feature of Java: variable shadowing
First, let’s define what is a shadowed field or method:
A field is considered shadowed when
- a subclass of its declaring class declares a field with the same name and same
- a variable having the same name and type is declared in the local scope
- a method argument/parameter is declared with a same name and type