1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
package com.github.nuistgy.testabstract;
abstract public class Animal { abstract public void shout(); static public void breath() { System.out.println("呼吸!"); } static int a; int b; public static void main(String[] args) { Animal.breath(); Animal.a = 1; } }
class Dog extends Animal{
@Override public void shout() { System.out.println("汪汪!"); } }
|