title: Why would you declare an Interface and then instantiate an object with it in Java?
body: <p>A friend and I are studying Java. We were looking at interfaces today and we got into a bit of an discussion about how interfaces are used. </p>
  
  <p>The example code my friend showed me contained this:</p>
  
  <pre><code>IVehicle modeOfTransport1 = new Car();
  IVehicle modeOfTransport2 = new Bike();
  </code></pre>
  
  <p>Where <em>IVehicle</em> is an interface that's implemented in both the car and bike classes. 
  When defining a method that accepts <em>IVehicle</em> as a parameter you can use the interface methods, and when you run the code the above objects work as normal. However, this works perfectly fine when declaring the car and bike as you normally would like this:</p>
  
  <pre><code>Car modeOfTransport1 = new Car();
  Bike modeOfTransport2 = new Bike();
  </code></pre>
  
  <p>So, my question is - why would you use the former method over the latter when declaring and instantiating the <em>modeOfTransport</em> objects? Does it matter?</p>