title: In java , is it possible that static polymorphic method can apply to super class
body: <p>I don't know how to describe the question exactly, sorry!<br>
  I have a class（E） base on a base class（B） , and in a helper class（Printer） ,two same name methods (printIt).
  These printIt methods use B or E as parameter, this is static polymorphism. </p>
  
  <pre><code>public class B {
      public void printMe(){
          System.out.println("i am b");
      }
  }
  
  
  public class E extends B {
      @Override
      public void printMe(){
          System.out.println("i am e");
      }
  }
  
  public class Printer {
  
      public void printIt(B b) {
          System.out.println("it is b");
      }
  
  //    public void printIt(B b) {
  //        if (b.getClass().equals(B.class)) {
  //            System.out.println("it is b");
  //        } else if (b.getClass().equals(E.class)) {
  //            E e = (E) b;
  //            printIt(e);
  //        }
  //    }
  
      public void printIt(E e) {
          System.out.println("it is e");
      }
  
      public static void main(String[] args) {
          B b = new B();
          E e = new E();
  
          B be = e;
  
          System.out.println("------------dynamic polymorphism ---------------");
          b.printMe();    //i am b
          e.printMe();    //i am e
  
          be.printMe();   //i am e
  
  
          System.out.println("------------static polymorphism ----------------");
          Printer printer = new Printer();
  
          printer.printIt(b);     //it is b
          printer.printIt(e);     //it is e
  
  
          System.out.println("-------------????????????????? -----------------");
          printer.printIt(be);    //it is b
      }
  }
  </code></pre>
  
  <p>In above code, the last printIt call will use "public void printIt(E e)" method to print " it is b ".  But "be" variable is a "E" object in fact , is there a way in "Printer" let java to choice method according to the class of object passed in. <br></p>
  
  <p>If i switch comments on "printIt(B b)" in above code, i wil get what i want, but is it tedious, because if I add many subclass of "B", i have to add many else if in it.</p>