0 votes
in JAVA by
In which process, a local variable has the same name as one of the instance variables?

i) Serialization

ii) Variable Shadowing

iii) Abstraction

iv) Multi-threading

1 Answer

0 votes
by

ii) Variable Shadowing

Reason: There are following reasons for considering a variable shadowing, they are listed below:

  • When we define a variable in a local scope with a variable name same as the name of a variable defined in an instance scope.
  • When a subclass declares a variable with the same name as of the parent class variable.
  • When a method is overridden in the child class.
...