It’s is just writing two different blocks of code in order to hide local variables.
From the answer to the question “Anonymous code blocks in Java”:
Blocks restrict variable scope.
public void foo() { { int i = 10; } System.out.println(i); // Won't compile. }
In practice, though, if you find yourself using such a code block then
it’s probably a sign that you want to refactor that block out to a
method.