#Im Making A Java Program That Asks You For A Login
84 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @muted flax! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
don't use == to cmpare strings
Looks like you're having some trouble comparing strings, check out this stackoverflow question for help.
alright i will check it
yes i know im just testing xd
but after i do it what should i do next to make the program check this and then continue
to check if the password is 123
you're using the strings "pass" and "passs"
you should use the variables pass and passs
if(pass.equals(passs))
alr
so i have one last thing
after everything i have this
which tells you to put a key '
everything works but when i go here
and add something
it gives me an error
what error
oh shit you are right
meow
yeah
cos variable is called key1 not key
you can't use variable before declaring it
oh alright let me see
yes but still lets me use what ever i want
i want it to use only this
as a key
you're comparing key1 with key1
move declaration of key outside if statementa nd compare key with key1
yes i understand but i want it first to ask you for the name and password
and then after successful and welcome
say String key = JOptionPane.showInputDialog("Enter Your Key");
right
at the moment that bit^ is inside the inner if statement, move it out
get username
get pass
if pass is right:
say hi
get key
if key is right
show username, password and key
at the moment you have "get key" inside "if key is right" which doesn't make sense
no probs
now if i want it to have a message that says like wrong key
how should i do it
i promise its my last thing and we done
damn
get username
get pass
if pass is right:
say hi
get key
if key is right
show username, password and key
else
show bad message
you too