title: Query on referencing in Java
body: <p>Consider the following inheritance example:</p>
  
  <pre><code>class A {...}  
  class B extends A  
  {  
   ..  
   ..  
   private static void main(String[] s)  
   {  
      A a1 = new A();  
      B b1 = new B();  
      B b2 = b1;             // What if it was B b2 = new B(); b2 = b1;  
   }
  }
  </code></pre>
  
  <p>My question is in the comment. Would it be different, in the sense that, using the <code>new</code> operator creates a new space for the object <code>b2</code> and <code>b2=b1</code> would just copy the data of <code>b1</code> into <code>b2</code>. So any changes done to one object won't affect the other. In the main inline code, <code>B b2 = b1</code> would point <code>b2</code> to the space allocated for <code>b1</code>. So any changes here would affect both the object data.</p>
  
  <p>My query is, will using the <code>new</code> operator make any difference to the object manipulation?</p>