How to illustrate scope problem when creating variables inside `if` statements in Java
I like to use an analogy from Finding Nemo.  I tell them their programming language has the same problem Dory has - short-term memory loss.  When a variable is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block.  So a block declares the "scope" of Dory's short term memory.

I've been concerned that students would think that the variables assigned in a block would lose their value after the block has ended, but I've never run into that problem for some reason.

What's interesting about your example is that it won't even compile without the print statement!  Java doesn't allow you to have a single declaration statement in an if or loop.