Whenever I try to add a country into my ArrayList<country> I keep on getting this error: unexpected token: ( and it highlights my countries.add line. I'm not sure why this is happening.
class country {
private int mland, mwaters; //mtotalborders;
private String mcenter;
country(int earth, int aqua, String yn) {
mland = earth;
mwaters = aqua;
mcenter = yn;
}
public int getLand() {
return mland;
}
public int getWaters() {
return mwaters;
}
public int getTotalBorders() {
return mland+mwaters;
}
public String getCenter() {
return mcenter;
}
}
country Turkey = new country(16, 7, "No");
country France = new country(22, 4, "No");
country England = new country(17, 9, "No");
country Germany = new country(26, 4, "Yes");
country Austria = new country(28, 1, "Yes");
country Italy = new country(17, 8, "Yes");
country Russia = new country(23, 3, "No");
ArrayList<country> countries = new ArrayList<country>();
countries.add(Turkey);
Stringwith two values, "Yes" or "No", is a pretty bad idea. Consider using abooleanor perhaps anenuminstead. This is not related to the problem you're having, though.