chapter 4
This commit is contained in:
19
src/chapter4/example10/Example10.java
Normal file
19
src/chapter4/example10/Example10.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package chapter4.example10;
|
||||
|
||||
abstract class Animal {
|
||||
abstract void shout();
|
||||
|
||||
}
|
||||
|
||||
class Dog extends Animal {
|
||||
void shout() {
|
||||
System.out.println("汪汪...");
|
||||
}
|
||||
}
|
||||
|
||||
public class Example10 {
|
||||
public static void main(String[] args) {
|
||||
Animal dog = new Dog();
|
||||
dog.shout();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user