This error occurs when you are trying to use a local variable without initializing it. ... If the compiler believes that a local variable might not have been initialized before the next statement which is using it, you get this error. You will not get this error if you just declare the local variable but will not use it.