class TypeA{} class TypeB{} class Foo { public static void main(String[] args) { TypeA a = new TypeA(); TypeB b = new TypeB(); if (a == b) { } } }