Is there a valid class Type variable that can be used with the instanceof operator? For Example:
String s = "abc";
Class<?> classType = String.class;
if (s instanceof classType) {
//do something
}
as an alternative to this:
if (s.getClass() == classType) {
//do something
}
Would there be any performance benefit?