I have some problem fixing some code .. Below is an the Depot class where it has an arraylist with vehicles .
in the code below i search and find all the cars based on the maker where i put as a parameter . the problem with the following code is that it returns both at the same time , the null that is based on not finding any cars by that maker and if it finds vehicles based on that maker .
thanks for all the help
GetMake is the method used in the Vehicle class to show the maker of the Vehicle and it is an abstract class
public Vehicle find(String findMaker)
{
for (Vehicle a : vehicleList)
{
if (a.GetMake() == findMaker )
System.out.println(a);
}
return null ;

New Topic/Question
Reply



MultiQuote



|