How is it possible to have ClassCastException after instanceof returns true
<p>I am getting the following code snippet from <a href="http://code.ohloh.net/file?fid=-0F0FCOc_Dgka3ovb86Swu0zffI&amp;cid=OpnM-8VCwHE&amp;s=Pair.java%20Android&amp;browser=Default#L44" rel="nofollow">Android's Pair.java</a></p>

<pre><code>public boolean equals(Object o) {
    if (o == this) return true;
    if (!(o instanceof Pair)) return false;
    final Pair&lt;F, S&gt; other;
    try {
        other = (Pair&lt;F, S&gt;) o;
    } catch (ClassCastException e) {
        return false;
    }
    return first.equals(other.first) &amp;&amp; second.equals(other.second);
}
</code></pre>

<p>I was wondering, how is it possible to have ClassCastException, after <code>instanceof</code> returns true.</p>
