here's the code:

string reply;
reply = getLineFromUser(); //assume this function works correctly
if(reply == "JAVA"){
System.out.println("OK to continue");
else {
System.out.println("Error - try again!");

i cant seem to see where i'm going wrong, thus cant get a correct version to work. I need it to keep repeating asking for a passwrod until its correct. Password equals JAVA.
Hope some1 can help, cheers.

Recommended Answers

All 2 Replies

if(reply == "JAVA"){
make this code as :


now it'll work properly. Strings are not compared by ==.

Thank you very much for your help - much appreciated!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.