Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with "LoginProgram"??

 
Diego Pinate
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I'm really new to java...
I'm trying to make a very simple "Login" program.
Here's my code:




The thing is, that if you type admin it doesn't work... It just go to the else part of the if statement... any advice?

[edit]Add code tags. CR[/edit]
[ September 30, 2008: Message edited by: Campbell Ritchie ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use the equals() method when comparing strings :

Check this article on Strings.
 
Diego Pinate
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! Thanks!!! that made my day XD heh I was frustrated heh! I'm really new to it. Thanks a lot!
 
Campbell Ritchie
Sheriff
Pie
Posts: 50270
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Diego Pinate: Welcome to JavaRanch

When you are posting code, can I draw your attention to the CODE button please; it makes your code much easier to read. I have altered your first post so you can see how much better it looks.

And everybody has that problem with == and equals() at some time.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic