How do I compare strings in Java?

sam
sam
134 Points
62 Posts

Hi,

How do I compare strings in Java?

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

Share:   fb twitter linkedin
Answers
Brian
Brian
Participant
536 Points
73 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
banner

Blog

Active User (2)

 Log In to Chat