#3 Types of Variable Scope in Java

11 messages · Page 1 of 1 (latest)

novel gulch
formal birchBOT
#

This post has been reserved for your question.

Hey @novel gulch! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

true trail
#

Kinda true, as far as the language bothers to define, they're both just local variables

#

It's just it's not super obvious that a local variable declared inside nested { and } is not visible from outside these { and }

#

And variables declared as part of a loop's ( and ) conditionals is visible only in these conditionals and inside the loop

novel gulch
true trail
novel gulch
#

does this count as "declaring the variable", myInt?

#

or this is merely declaring a parameter, which is different from declaring a variable?