小编Luf*_*val的帖子

如何在处理中向一个arraylist添加一个类?

每当我尝试添加一个country到我的ArrayList<country> 继续得到这个错误:unexpected token: (它突出我的countries.add线.我不确定为什么会这样.

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, …
Run Code Online (Sandbox Code Playgroud)

java processing arraylist

2
推荐指数
1
解决办法
265
查看次数

标签 统计

arraylist ×1

java ×1

processing ×1