I am writing a function that tests whether variable of type Object is of a given type. For example, if I put in "This is a string"
and String.class
as the params, it should return true.
I have tried the following code:
public static boolean Debug(Object variable, Class<?> testClass) {
if (variable instanceof testClass) {
return true;
}
return false
}
However, I got the error: "testClass cannot be resolved to a type".
I am not quite sure why this is.
Any suggestions would be greatly appreciated.