This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Whenever you use a local variable in a method, before you use that variable in any kind of comparison or calculation or other statement that depends on its value, you must make sure that that variable is initialized before it is used. Because it's possible that for loop may never execute, and you only initialize the variable in the for loop, the compiler complains that it may not have been initialized.
To expand on above point, you need to also understand how local variables and class or instance variables are stored.
Each time an object is created in Java it goes into the area of memory known as heap. The primitive variables like int and double are allocated in the stack, if they are local method variables and in the heap if they are member variables (i.e. fields of a class). In Java methods local variables are pushed into stack when a method is invoked and stack pointer is decremented when a method call is completed.