Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@Justin In this instance, I thought it more important to encourage the good practice of properly closing resources, rather than nitpick over whether the System.in should really be closed (ever). But it's a valid remark.
An enhanced for loop is basically syntactic sugar for a for loop over an Iterable using its Iterator or over an array. The syntax allows you to specify the minimum to get a for loop. for (Type a : b) will assign to a each element of b of type Type in turn, until all of b's elements have been looped, or the loop code breaks out of the loop.