I’m looking at this code and it looks like:
blah("....");
{
call1(blah);
call2();
{
inner1("...");
inner2("...");
}
}
I’m new to java so interested to know what to search, this style looks interesting.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not doing things inline, it’s just setting up a separate scope. If you declare variables in that “inner” block, they won’t be available in the outer one. It can be useful if you copy-paste a few lines of code and want to make sure you aren’t reusing variables from the first bit in the second bit. I’ve done it occasionally in unit tests, but more often than not, it’s a sign that you may need to refactor a bit.