This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Yes you are right this is due to final keyword only. Beacuse if a variable is declared as final it is compile time constant and the value will be known to the compiler that it is within the range.Try the same program with
final int i=1000; then you will be getting Compile time error.