Java - myVar cannot be resolved to a variable -


while (somecondition) {     double myvar = somefunc(); // somefunc returns 41      if (myvar > 0) {      string precision ="##";      decimalformat df = new decimalformat("0."+precision);      // breakpoint set on next line      double myvarpercentage = double.parsedouble(df.format((myvar/50)*100));     } } 

when @ value of myvar via eclipse states cannot resolved variable despite somefunc() resolving 41. above fragment executing inside loop inside instance method , there no other variables in scope entitled 'myvar'.

do have declare double outside loop?

i assume debugging in eclipse. compiled .class older .java source, , such effect. compiled code places line number info in code bit skewed, instance in multi-line if-condition.

place breakpoint bit before , single-step.


Comments