File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Help with simple String? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with simple String?" Watch "Help with simple String?" New topic

Help with simple String?

Peter Hammar
Ranch Hand

Joined: Mar 01, 2010
Posts: 34

First time poster here!

This is the code:

Im doing a very simple math program. It takes two int values and adds them together in a method (not shown above). But when I get the question if I want to continue, no matter what I write, I always get the "Good Bye!"...whats missing? I know it has something to do with the String, as I have tested this using INT (I do have a while loop)...


David Newton

Joined: Sep 29, 2008
Posts: 12617

Because you don't compare strings with "==", but with .equals.

Welcome to JavaRanch!
Peter Hammar
Ranch Hand

Joined: Mar 01, 2010
Posts: 34
Thanks, that helped alot!
Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 484

Peter for more informations read this POST

I agree. Here's the link:
subject: Help with simple String?
It's not a secret anymore!