Am new to java.How can I solve this small problem? Am using database based authentication to enable mi logon.Am trying to compare the username and passfield fields but I dont know the best conditional operator/logic operator to use. Here is my sample code that contains a red wavy underline in the Netbeans IDE am using.

If (userName !false) && (password !true)
System.out.println("Invalid Password")

Please can anyone show me the right way to do that?

7 Years
Discussion Span
Last Post by jwenting

Telling you the solution will not solve anything. Net Beans tell you where the error is and what is the problem. If you can't fix it then I would suggest to stop what you are doing and start by reading very, very basic tutorials and try to learn simple basic core java and programming.

I believe that what you are trying to do is too advanced for the skills you have, so it is better to study a bit more.

Also if you want authentication, You need to compare the username given with the one that the query returns. You only have one username in your if expression and you are trying to find it out if it is false or not. I don't think that username can be neither true nor false, because I assume that username is a String. Comparing the username given with the one that the query returns will result true or false.
The same applies for password

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.