public class Mao {
public static void main(String[] args) {
Cat cat=new Cat();
cat.play();
cat.eat();
}
}
class Cat{
private String color;
private int age;
public void setColor(String color) {
this.color=color;
}
public String getcolor() {
return this.color;
}
public void setColor(int age) {
this.age=age;
}
public int getAge() {
return this.age;
}
public void eat() {
System.out.println("猫吃鱼");
}
public void play() {
System.out.println("猫玩球");
}
}
/*public class java2 {
public static void main(String[] args) {
Cat aa=new Cat();
aa.get("花");
aa.set(5);
aa.eat();
aa.piay();
}
}
class Cat{
private String color="";
private int age;
public void get(String color) {
this.color=color;
}
public void set(int age) {
this.age=age;
}
public void eat() {
System.out.print("年龄:"+this.age+this.color+"猫爱吃鱼");
}
public void piay() {
System.out.println("喜欢玩球");
}
}
*/
猫吃鱼,猫玩球
最新推荐文章于 2023-08-02 20:41:18 发布