title: why Reference Objects hold the references of a Particular Type only
body: <p>when we allocate an object on heap and store its reference using the 'new' keyword in the reference objects like this </p>
  
  <pre><code>Class referenceObject = new Class();
  </code></pre>
  
  <p>every thing work fine </p>
  
  <p>but why cannot our 'refernceObject' hold the reference to the another type like:</p>
  
  <pre><code>referenceObject = new AnotherClass();
  </code></pre>
  
  <p>as the references are the memory addresses pointing to the memory location .</p>
  
  <p>i mean if i have an integer type i can assign any Integral value (please avoid sizes)
  let us say 1 to 10 i.e</p>
  
  <pre><code> int i=1;
   i=2;
   ...
   i=10;
  </code></pre>
  
  <p>this works as we can say the type we assigning is same int for this example</p>
  
  <p>what confuses me is why is not the same true for references .</p>
  
  <p>more examples</p>
  
  <p>i think it is like :
    we can assign any value which is the element of Set(Integers) to 'i',
   but we cannot assign any value which is the element of Set(References) to 'objectReference' </p>
  
  <p>if it is like this what is the reason ?</p>
  
  <p>any suggestion/help is welcomed and appretiated </p>
  
  <p><strong>To Downvoters: please comment your reason for downvoting or is it like you can't answer this</strong> </p>