This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
As the previous poster told the static methods cannot be overridden , but can be redefined in the child class . In your case the method has been redefined.
In the first case : A x = new A() ; x.method(); ... dont get confused by the instance x . One thing to remember is that static methods belong to the class and not to any specific instance. x.method() will be replaced by the ClassName.method() i,e A.method.
In the second case A y = new B() where B extends A . Again you have called the method y.method(). Dont get confused by the instance y since the method you are calling is a static method. It will replace y by class name i.e A.method() again.
If you want the method in class B to run then you have to call it as B.method();
Remember : Static methods dont belong to any instance as such , they belong to the class. So dont be confused even if they are called using reference to any class. The reference will be replaced by the respective class name.