我创建了两个数组,其中存储了两个字符串值数组,现在我想通过使用if条件进行比较,请帮助我。
我确实喜欢这个......
String[] source={"Chennai","Bangalore","Hyderabad"};
String[] destination={"Chennai","Bangalore","Hyderabad"};
if(source[0] == "Chennai" && destination[2] == "Hyderabad") {
//Here i want to print some thing
}
答案 0 :(得分:0)
试试这个:
if(source[0].equals("Chennai") && destination[2].equals("Hyderabad"))
{
Here i want to print some thing
}