wood burning stoves*
The moose likes Beginning Java and the fly likes Help with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with "LoginProgram"??" Watch "Help with "LoginProgram"??" New topic
Author

Help with "LoginProgram"??

Diego Pinate
Greenhorn

Joined: Sep 29, 2008
Posts: 2
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

You need to use the equals() method when comparing strings :

Check this article on Strings.


[My Blog]
All roads lead to JavaRanch
Diego Pinate
Greenhorn

Joined: Sep 29, 2008
Posts: 2
Oh! Thanks!!! that made my day XD heh I was frustrated heh! I'm really new to it. Thanks a lot!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with "LoginProgram"??