How do I compare strings in Java?

sam
sam
134 Points
62 Posts

Hi,

How do I compare strings in Java?

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

Share:   fb twitter linkedin
Answers
Brian
Brian
Participant
570 Points
75 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