eclipse创建一个村庄类Village
时间: 2023-05-17 20:06:07 浏览: 95
好的,以下是创建一个村庄类Village的示例代码:
public class Village {
private String name;
private int population;
private String location;
public Village(String name, int population, String location) {
this.name = name;
this.population = population;
this.location = location;
}
public String getName() {
return name;
}
public int getPopulation() {
return population;
}
public String getLocation() {
return location;
}
public void setName(String name) {
this.name = name;
}
public void setPopulation(int population) {
this.population = population;
}
public void setLocation(String location) {
this.location = location;
}
}
希望这可以帮助你!
阅读全文