Checking a class type (.class) is equal to some other class type
Is the following code valid?
void myMethod (Class classType) {
if (classType == MyClass.class) {
// do something
}
}
myMethod (OtherClass.class);
If not is there any other approach where I can check if a passed .class (Class Type) is of type - MyClass ?