How do I compare strings in Java?

sam
sam
378 Points
48 Posts

Hi,

How do I compare strings in Java?

Views: 10200
Total Answered: 1
Total Marked As Answer: 0
Posted On: 25-Jul-2015 09:18

Share:   fb twitter linkedin
Answers
Brian
Brian
2376 Points
13 Posts
         

Hi Sam,

use .equals() method:

string1.equals(string2)

It returns true if string1 is equals to string2 in value. Else, it will return false.

Posted On: 31-Jul-2015 00:18
 Log In to Chat