class B extends A { static public void printMe(){ System.out.println("in static B"); } } class A{ static public void printMe(){ System.out.println("In static A"); } } public static void main(String[] args) { A a = new B(); a.printMe(); } Why is the output "In static A" ?
A.printMe()orB.printMe(). I consider Java allowing to call static methods on an instance an error in the language specs...