-2

I already tried with string.equal function which will compare two strings, but what will be optimize way of doing same. Suggestions are welcome.

Hi all got it may help others What's the quickest way to compare strings in Java? Thanks Saurabh for sharing link.

Community
  • 1
  • 1
harsh
  • 9
  • 5

1 Answers1

0

According to me, You should use the equals() method of the String class to compare Strings.

if (xyz.equals("something")) { 
    //Do what you want if string is equal... 
}

see this also..

Community
  • 1
  • 1
Saurabh Vardani
  • 1,821
  • 2
  • 18
  • 33