chandu chandu - 1 year ago 63
Java Question

How to compare two auto complete text view by using If condition

I created two arrays in that stored two array of string values now I want to compare by using if condition please help me.

I did like this....

String[] source={"Chennai","Bangalore","Hyderabad"};

String[] destination={"Chennai","Bangalore","Hyderabad"};

if(source[0] == "Chennai" && destination[2] == "Hyderabad") {
//Here i want to print some thing

Answer Source

Try this:

if(source[0].equals("Chennai") && destination[2].equals("Hyderabad"))
      Here i want to print some thing