Variable x is already defined in this method
March 9th, 2009
Applies to:
NA
Description:
There is more than one declaration of the same variable in the same method
Cause:
The variable is declared more than once:
public void myTest()
{
int x = 0;
System.out.println(x);
int x = 8;
System.out.println(x);
}
Declare the variable only once in the same method.
Example:
public void myTest()
{
int x = 0;
System.out.println(x);
x = 8;
System.out.println(x);
}