/* * 定义世界杯类WorldCup,该类包括序号id、举办年份year、举办国country、冠军队team四个私有成员变量(已定义)。 * 在该类中定义有参构造方法和所有成员变量的set、get方法。 */ import java.util.*; class WorldCup { private int id; //序号 private int year; //举办年份 private String country; //举办国 private String
时间: 2023-06-05 18:04:08 浏览: 54
team; //冠军队 public WorldCup(int id, int year, String country, String team) { this.id = id; this.year = year; this.country = country; this.team = team; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getTeam() { return team; } public void setTeam(String team) { this.team = team; } }