67,513
社区成员
发帖
与我相关
我的任务
分享
public abstract class Game {
protected String type;
protected String name;
abstract public void play();
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public class MobileGame extends Game {
@Override
public void play() {
System.out.println("晚上不睡觉玩:"+this.name + "游戏类型" +this.type);
}
private void effort(){
System.out.println("上课困");
}
private void damage(){
System.out.println("");
}
public void prepare(){
effort();
damage();
}
public MobileGame(String type,String name) {
this.type = type;
this.name = name;
}
public MobileGame() {
}
}
大概就这样自己改一改