title: Is it possible to have Runtime type mismatch in Java?
body: <p>I am reading up OCaml and from wiki, it says:</p>
  
  <pre><code>*its static type system renders runtime type mismatches impossible*
  </code></pre>
  
  <p>I understand why, but then I think, why is this so special in OCaml (and FP)? How do you cause a runtime type mismatch in, say, Java? e.g.</p>
  
  <pre><code>boolean a = true;
  int b = a + 1;
  </code></pre>
  
  <p>will return an error in compile time. </p>
  
  <p>EDIT 1:</p>
  
  <p>Haskell</p>
  
  <pre><code>func :: Int -&gt; Bool
  func i = if i &gt; 0 then True else False
  </code></pre>
  
  <p>Java</p>
  
  <pre><code>boolean func (int i) {
      if (i &gt; 0) return true; else return false;
  }
  </code></pre>
  
  <p>Isn;t it the case that both will guarantee the argument type when the <code>func</code> is called?</p>