•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 456,533 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,906 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 2973 | Replies: 2
![]() |
•
•
Join Date: Aug 2004
Posts: 11
Reputation:
Rep Power: 5
Solved Threads: 0
code repeatedly 2 ask user 4 a password until correct (=Java) but cant c wots wrong.
#1
Aug 10th, 2004
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.
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.
Re: code repeatedly 2 ask user 4 a password until correct (=Java) but cant c wots wrong.
#2
Aug 10th, 2004
if(reply == "JAVA"){
make this code as :
if(reply.equals("JAVA");
now it'll work properly. Strings are not compared by ==.
make this code as :
if(reply.equals("JAVA");
now it'll work properly. Strings are not compared by ==.
•
•
Join Date: Aug 2004
Posts: 11
Reputation:
Rep Power: 5
Solved Threads: 0
Re: code repeatedly 2 ask user 4 a password until correct (=Java) but cant c wots wrong.
#3
Aug 10th, 2004
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access activation api blogger blogging blogs code com combo crack dani daniweb data debugging development dreamweaver dropdownlist gdata google gpl html innovation java key linux microsoft microsoft sdk for java microsystems module net news open openbsd password platform playstation product programming ps3 reuse rss security serial source sun tags vista web xml
- Lost Windows XP user password (Windows NT / 2000 / XP / 2003)
- HELP: User Log In From Connected in Access Database (C#)
- need help with user and password (Visual Basic 4 / 5 / 6)
- interaction with MySQL (Shell Scripting)
- OS10.3: User password not accepted at start-up (OS X)
- User name and password for DirectoryEntry (C#)
Other Threads in the Java Forum
- Previous Thread: Any chance of a little help?
- Next Thread: Full Screen



Linear Mode