title: What is the difference between run-time error and compiler error?
body: <p>In one of my prof slides on ploymorphism, I see this piece of code with a couple of comments:</p>
  
  <pre><code>discountVariable =              //will produce
    (DiscountSale)saleVariable;//run-time error
  discountVariable = saleVariable //will produce
                                  //compiler error
  </code></pre>
  
  <p>As you can see, it says in the first casting statement that it'll produce <em>run-time</em> error and in the other one it says it'll produce <em>compiler error</em>.</p>
  
  <p>What makes these errors? and how they differ from each other?</p>