I recently read some code that uses a special syntax regarding {}
, I've asked a more experienced Java developer, but he also can't answer.
public void doSomething() {
someWorks();
{
someVariables;
someMoreWorks();
}
someEvenWorks();
{
...
}
}
Why does the code author put these lines inside {}
? I guess that the variables declared within the {}
will be released right after execution exits {}
, right, because I can't access these outside the {}
anymore?