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 ?

Edit
Report