title: How to deal with classcasting Java x Scala?
body: <p>I'm having a problem using Scala x Java.</p>
  
  <p>To contextualize you about the situation let me put a quick example:</p>
  
  <ul>
  <li>Java Class</li>
  </ul>
  
  <pre class="lang-java prettyprint-override"><code>public class Animal {
  }
  </code></pre>
  
  <ul>
  <li>Java Class</li>
  </ul>
  
  <pre class="lang-java prettyprint-override"><code>public class Cat extends Animal {
  }
  </code></pre>
  
  <ul>
  <li>Scala class</li>
  </ul>
  
  <pre class="lang-scala prettyprint-override"><code>class Dog extends Animal {
  }
  </code></pre>
  
  <ul>
  <li>Java class</li>
  </ul>
  
  <pre class="lang-java prettyprint-override"><code>class Main {
    public static void main(String[] args) {
      Animal animal1 = new Dog(); //Java's Animal receives Scala's Dog reference
      Animal animal2 = new Cat(); //Java's Animal receives a Java's Cat reference
    }
  }
  </code></pre>
  
  <p>I'm receiving an error message like:</p>
  
  <pre><code>Type mismatch: cannot convert from Dog to Animal
  </code></pre>
  
  <p>But the same doesn't happens to the class Cat.</p>
  
  <p>Someone could kindly explain me what is happening here?</p>