2 Replies Latest reply: Jun 22, 2010 5:13 AM by 843810 RSS

    Why am i getting both true and false on a boolean at the same time?

    843810
      Why am i getting a return of both true and false on a boolean at the same time?
      This is part of my code:
      switch (cStoreInput)
       {
          //case ' ': if(!isInputValid(getInputOnString())) Error.errorVarOrFunctionDoesNotExist(nRow); break;
          //case ';': if(!isInputValid(getInputOnString())) Error.errorVarOrFunctionDoesNotExist(nRow); break;
          case ' ': System.out.println(isInputValid(getInputOnString())); break;
      }
      private static boolean isInputValid(String strInput)
          {
              if (strInput.equals("abc"))
              {
                  strValueTryingToStore = strInput;
                  nCurrentState = 0;
                  if (isTextValid() != null)  return true;
              }
      
              return false;
          }
      in cmd, it says
      true
      false

      Im pretty sure it should return true, but why is there a false? I only called that boolean function once.

      btw, all of my functions are in static.