抽象类名作为形参和返回值

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

上一篇:第十五章:指针类型


下一篇:cat命令读取一部分_命令注入绕过方式总结