Another way might be to change the while loop to

while(!strInput.equals("stop"))

and get rid of if block.