package com.daxing_01;
public class Cat {
public void eat() {
System.out.println("猫儿爱吃鱼!");
}
}
package com.daxing_01;
//操作类
public class CatOperator {
public void uesCat(Cat c){
c.eat();
}
}
package com.daxing_01;
public class CatDemo {
public static void main(String[] args) {
CatOperator co = new CatOperator();
Cat c = new Cat();
co.uesCat(c);
}
}
运行结果:
猫儿爱吃鱼!
Process finished with exit code 0