This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 483

Peter for more informations read this POST

I agree. Here's the link:
subject: Help with simple String?
Similar Threads
Triangular Output
Priority First Search and Adjacency Matrix
cleaner code
Parsing a String Program Help
Teach me to program!!