Java Local variable inaccessible to nested statements -


i working on project , ran problem. have following code:

private void evaluatecurrentoperation() {      double token;     object currentoperator = thisexprstack.pop();     double currentoperand;     double result = 0.0;      while (!thisopstack.isempty()) {         currentoperand = thisopstack.pop();          if (currentoperator.equals('+')) {             result += currentoperand;         }         if (currentoperator.equals('-')) {             result -= currentoperand;         }         if (currentoperator.equals('/')) {             result /= currentoperand;         }         if (currentoperator.equals('*')) {             result *= currentoperand;         }      }     thisexprstack.push(result);  } 

i using eclipse , when tried use local variable "result" inside if blocks had warning saying result not being used. confused because used variable acts doesn't exist. new java not know how debug code.

when push "result" onto "thisexprstack", pushes 0.0. value initialized to. how push "result" inside if blocks?

ignore previous answer. relevant thisexprstack , thisopstack populated?


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -