Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Animal1 {
- //重写是对父类允许访问的方法的实现过程进行重新编写,返回值和形参都不能改变。
- //即外壳不变,核心重写
- public void move(){
- System.out.println("动物可以移动");
- }
- }
- class Dog extends Animal1{
- public void move(){
- System.out.println("狗可以跑和走");
- }
- }
Add Comment
Please, Sign In to add comment