I am having trouble with this method of my class. It always returns false. Passenger is a separate class. This is a method in my Train class which creates an array list of Passenger objects. I am making a method that will search the ArrayList passengerList for a Passanger object with the name as the parameter.
public boolean search(String a){
Passenger temp;
boolean query = false;
for (int i =0; i<passengerList.size(); i++)
{
temp=passengerList.get(i);
if (temp.getName() == a)
{
query = true;
}
}
return query;
}