KnowledgeBoat Logo
|

Computer Applications

Java resolves duplicate variable name to ……………. .

  1. global variable
  2. local variable
  3. most local scope variable
  4. all the above

Encapsulation & Inheritance in Java

8 Likes

Answer

most local scope variable

Reason — Java resolves duplicate variable name to most local scope variable. For example, if a local variable is having the same name as that of a global class element, then the most local variable with the same name will be considered. The global variable will be hidden by the local variable.

Answered By

4 Likes


Related Questions