Variable Shadowing
Inner scope variable hides outer variable with same name.
functionsscopeUpdated 2025-09-01
Concept
- Avoid reusing names to prevent confusion.
Example
- int x=5; { int x=7; System.out.println(x); } // prints 7
Inner scope variable hides outer variable with same name.