How to compare two string in java?

Recommended Answers

All 3 Replies

Read the API for String. There is a method there, inherited from Object, with the same name as the symbol used in many comparisons. Use that method. (And, yes, I am being purposely obscure.)

Edit: Aaarrgh, and another newb has already given code. Do not give out easy answers without the poster showing some initiative. I can almost guarntee this is some sort of homework/assignment question, and he should do those himself, not just be given an answer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.