-->
当前位置:首页 > 题库

PROGRAMMING:Program error correction 2

Luz5年前 (2021-05-10)题库419
Program correction. There are errors in the following code, please modify and submit.

public class Main {
public static void main(String[] args) {
Animal animal = new Dog();
animal.shout();
animal.run();
}
}
class Animal {
void shout() {
System.out.println("animal shout!");
}
}
class Dog extends Animal {
void shout() {
super.shout();
System.out.println("wangwang……");
}
void run() {
System.out.println("Dog is running");
}
}

###Input format:
###Output format:
###Input example:
```in
nothing
```
###Output example:
```out
animal shout!
wangwang……
Dog is running
```







answer:If there is no answer, please comment