why we cann't override static methods
1 class A{
2 static void go() {
3 System.out.println("red");
4 }
5 }
6 class B extends A {
7 static void go () {
8 System.out.println("green");
9 }
10 public static void main(String args[]) {
11 go(); //outputs green
12
13 A a=new B();
14 a.go();//outputs red
15 }
from line 11 it seems method is overridden
but from 14 , we get to know its not overridden
why is the difference? why cann't we override the static methods? Is there any use of static method? Is there any advantage of static method over instance method