Code:
public class Guess
{
double gOld[], gNew;
String result = "";
int i;
double a = Math.random();
Guess(double guess)
{
[COLOR="DarkOrange"]gOld[i]=guess;[/COLOR]
while(Math.abs(gNew - gOld[i])>0.000000005)
{
result = result + gNew + "\n";
gNew = (Math.pow(gOld[i],2)-a)/2*gOld[i];
i++;
gOld[i] = gNew;
}
}
public String toString()
{
return result;
}
}
I am getting the error at orange part. I've read that the error means something could not initialized. But I don't see the error here. "i" is default at zero, so it should take the value "guess" and store it at index 0 of the array.