| | |
code repeatedly 2 ask user 4 a password until correct (=Java) but cant c wots wrong.
![]() |
•
•
Join Date: Aug 2004
Posts: 11
Reputation:
Solved Threads: 0
code repeatedly 2 ask user 4 a password until correct (=Java) but cant c wots wrong.
0
#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.
0
#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:
Solved Threads: 0
Re: code repeatedly 2 ask user 4 a password until correct (=Java) but cant c wots wrong.
0
#3 Aug 10th, 2004
![]() |
Similar Threads
- Encrypted User/Password when logging in to FTP Server (C++)
- insert user and password in window of Windows Autenticate Box HTML code (Visual Basic 4 / 5 / 6)
- insert user and password in window of Windows Autenticate Box HTML code (Windows NT / 2000 / XP)
- need help with user and password (Visual Basic 4 / 5 / 6)
- java Calculator- wrong calculation (Java)
- AD Password Reset Code (VB.NET)
Other Threads in the Java Forum
- Previous Thread: Any chance of a little help?
- Next Thread: Full Screen
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle plazmic print problem program programming project radio recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree unlimited utility webservices windows






