What is better to check if an object is an instance of a class?
object instanceof class
or
object == class.instance
Is it better to use first option where I need to import the class into another class to check if the object is an instance of the class, or to check if its equal to an object of the class initialized in its class?
I'm currently using instanceof
method but I'm not sure if it's better to use that or maybe some other solutions.