Cannot Find Symbol
I get this error when I try to run my code.
C:\Documents and Settings\Jason\My Documents\TSM\MyArrayList.java:89: cannot find symbol
symbol : method newCity(java.lang.String,double)
location: class MyArrayList<T>
newCity(name, distance);
^
1 error
This is where it happens.
int size = list2.size();
City[] cityList = (City[]) list2.toArray();
ArrayList<City> cityList2 =new ArrayList<City>();
String name =new String();
City newCity;
double distance;
for (int i = 0; i < size; i++){
name = cityList[i].getName();
distance = currentCity.getDistance(cityList[i]);
>>>newCity(name, distance);
cityList2.add(newCity);
}
But City has a constructor for that.
public City(String name,double distance){
this.name = name;
this.distance = distance;
}
What's wrong?
Message was edited by:
bronzey214

