title: Cannot access method from superclass when subclass instantiated using Object variable
body: <p>I was practising inheritance and had these classes where Bite extends the Gulp class.</p>
  
  <pre><code>public class Gulp {
      public void method2() {
          System.out.println("Gulp 2");
          method3();
      }
  
      public void method3() {
          System.out.println("Gulp 3");
      }
  }
  
  public class Bite extends Gulp {
      public void method1() {
          System.out.println("Bite 1");
      }
  
      public void method3() {
          System.out.println("Bite 3");
      }
  }
  </code></pre>
  
  <p>I am trying to invoke the method <code>method2()</code> by creating objects of Bite class(using three different kind of references: Object,Bite and Gulp) as below: </p>
  
  <pre><code>public class Main {
      public static void main(String[] args) {
          Object varObj = new Bite();
          Bite varBite = new Bite();
          Gulp varGulp = new Bite();
  
          if(varBite.getClass() == Bite.class) 
              System.out.println("Bite class");
  
          if(varObj.getClass() == Bite.class) 
              System.out.println("Also Bite class");
  
          varBite.method2();
          //prints what is expected
  
          varObj.method2();
          //throws compilation error -- cannot find method2()
  
          varGulp.method2();
          //prints what is expected
      }
  }
  </code></pre>
  
  <p>I am getting error when the reference variable is type of Object. It says, it cant find the symbol although the <code>varObject.getClass()</code> returns Bite.class.
  Could anyone please explain..</p>