Variable scope demo (return value)
Java
Hard
4 views
Problem Description
Task: show variable shadowing safely by computing result with local variables only.
Output Format
Return value
Constraints
Keep code readable.
Official Solution
static int shadowingDemo(int x){int res=x;{int y=res+1;res=y*2;}return res;}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!