Compare class objects
<p>I have to compare a class object against a list of pre defined classes. Is it safe to use == or should I use equals()? </p>

<pre><code>if        (klass == KlassA.class) {
} else if (klass == KlassB.class) {
} else if (klass == KlassC.class) {
} else {
}
</code></pre>

<p><strong>Note:</strong> I cannot use instanceof, I don't have an object, I just have the class object. I (mis)use it like an enum in this situation!</p>

<p>Thanks!</p>
