출처: http://stackoverflow.com/questions/2223386/why-doesnt-java-allow-overriding-of-static-methods

Overriding depends on having an instance of a class. The point of polymorphism is that you can subclass a class and the objects implementing those subclasses will have different behaviors for the same methods defined in the superclass (and overridden in the subclasses). A static method is not associated with any instance of a class so the concept is not applicable.


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
public class AA {
 
    public static void print() {
        System.out.println("STATIC AA");
    }
 
    public void print2() {
        System.out.println("AA");
    }
}
 
public class BB extends AA {
 
    public static void print() {
        System.out.println("STATIC BB");
    }
 
    public void print2() {
        System.out.println("BB");
    }
 
    public static void main(String[] args) {
        AA a = new BB();
        a.print();
        a.print2();
    }
}
1
2
STATIC AA
BB