Static Gotcha in java

class PreTesting
{
    static void doSomething()
    {
        System.out.println("Method in parent class");
    }
}
public class Testing extends PreTesting
{
    static void doSomething()
    {
            System.out.println("Method in child  class");
    }

    public static void main(String args[]) throws Exception {
      PreTesting preTesting =  new Testing();
      preTesting.doSomething();
  }
}

//outout is : Method in parent class

Comments