Is there any way to take this chunk of an else if and make it its own method? I would need the values of valid and throwLine() to be done in the method containing this if else statement, but I'm around 45 lines in my method which is 15 more than I'm allowed to have for simplicity.    else if(isOperator(readIn))         {            System.out.print(readIn);            if(myStack.isEmpty())               valid = false;            else               op2 = (Fraction)myStack.pop();            if(myStack.isEmpty())            {               throwLine(readIn);               valid = false;            }            else            {               runTheOperator(op2, op1, readIn);               readIn = stdin.next();            }
Modularizing an else if statement
java;beginner