Programming MisconceptionsHomeMisconceptionsConceptsLanguagesTextbooksContributorsAbout
HomeLanguages
Java
jls21
Scope of a Declaration

Java Language Specification, Version Java SE 21 Edition
6.3. Scope of a Declaration

Read this Section of the Authoritative Specification

https://docs.oracle.com/javase/specs/jls/se21/html/jls-6.html#jls-6.3

2 Documented Misconceptions

Misconception
ForVariableScopeBeyondLoop
The scope of variables declared in a for loop header extends beyond the loop
Misconception
LoopBodyScopeImpliesLoopLifetime
Lifetime of variables declared in a loop body extends across all loop iterations

Find Misconceptions by...

Concept
Programming Language
Notional Machine
Textbook

About

About This Site
Structure and Content of the Inventory
Contributors