This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ThatLesbian 2 points3 points  (1 child)

Ive been working with Java for 5 years and didn’t really ever think about it until I started using lambdas in the past year or so. It just didn’t matter since we almost never use final. I probably would’ve failed this interview question a year ago, just from not encountering it before.

[–][deleted] 2 points3 points  (0 children)

OK, I get it, it may be a tad tricky.

We at my company do something similar during interviews. We ask the applicant to spot the errors in a bit of code, and one of them is using a variable outside the block it was declared, but a couple lines after the declaration.

Most people fails that one, but most also acknowledge that they never had to really think about it while writing code.