Your variable x is a Scanner object. I think what you're looking to do is compare the "ans" variable instead.