Start learning →

What happens in Java if an inner block re-declares an outer local variable?

AWarning at runtime
BSilent masking
CAuto-renaming
DSyntax error
Answer & Solution
Correct answer: D. Syntax error
Java disallows nesting a local variable that hides another, causing a syntax error.
Practise this question with Quill — ICSE Class 10 →

Keep practising Classes, Encapsulation and Scope

Browse all Classes, Encapsulation and Scope questions for ICSE Class 10, or explore more Computer Applications topics.

Start a Classes, Encapsulation and Scope lesson →