My main method asks the user for an expression, an input that will be something like "5 4 +" or "6 4 + 8 /" with operands and operators separated by a space. I have a method that processes this input and gives the answer to what it equals. It loops through all the numbers inputted through a while loop that ends once `scnr.hasNext() == true`, or when the errorMessage isn't null. Currently, `scnr.hasNext()` is becoming false sooner than its supposed to, causing the loop to only read the first number, and then end. It is becoming false because I try to store `scnr.nextInt()` into a variable. I need for it to take just the first number, and leave the rest, which I think will keep `scnr.hasNext()` true. Here is my entire method 

```
public static Number evaluateExpression(String expr) {
        int var = 0;
        String input = "";

        String tooFewOperands = "Too few operands";
        String unKnownOperator = "Unknown operator:";
        String tooManyOperands = "Too many operands.";

        Stack<Integer> stack = new Stack<>();
        String errMsg = null;

        Scanner scnr = new Scanner(expr);

        while (scnr.hasNext() && errMsg == null) {
            if (scnr.hasNextInt()) {
                var = scnr.nextInt();                           //Problematic line
                System.out.println("Operand read: " + var);
                stack.push(var);
            } else {
                input = scnr.next();
                if (checkValidOperator(input) == input.toCharArray()[0]) {
                    System.out.println("Operator read: " + input);
//                    stack.push(var);
                    if (stack.size() >= 2) {
                        execute(stack, input.toCharArray()[0]);
                    } else {
                        errMsg = tooFewOperands;
                    }
                } else {
                    errMsg = unKnownOperator + " " + input + " ";
                }
            }
            System.out.println("------ Stack state -----");
            System.out.println(stack.toString());
            System.out.println(scnr.hasNext());
        }
        if (errMsg != null) {
            System.out.println("Failed evaluation of |" + expr + "|\n" + errMsg);
            return null;
        }
        if (stack.size() > 1) {
            System.out.println("Failed evaluation of |" + expr + "|\n" + tooManyOperands + stack.toString());
            return null;
        } else {
            return stack.peek();
        }
    }

```

Notice that `Scanner scnr` is initialized with `String expr`, I think my teacher hinted at that allowing me to read individual tokens from the `scnr`. She said "Initialize a scanner using expr as a parameter to its constructor, which will allow you to read tokens from the expression." I've never initialized a Scanner with something other than `System.in`. She also specified that to make this method I should "Write a loop that will run as long as the scanner has input (hasNext) and error message is null." So that is what the while condition has to be.