This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I just typed the following simple program which gets an userinput to the variable inData. Then the input is checked for having typed "x" or not. For me, the if statement should work, but the program always says "You have not typed x!" even when typing x.
Use !inData.equals("x") and inData.equals("x") instead of inData != "x" and inData == "x". Strings are objects, and with != and == you're comparing references, not String contents. That's what equals does.