ICSE Class 10 Computer Applications
Question 7 of 16
Encapsulation and Inheritance — Question 8
Back to all questions 8
Question Question 8
Is it legal to define local variables with the same identifier in nested blocks?
No, it is illegal to define local variables with the same identifier in nested blocks
The local variable declaration space of a block includes any nested blocks. Thus, within a nested block it is not possible to declare a local variable with the same name as a local variable in an enclosing block.