How to return .class from Java method? -


from utility method in java intend return .class, not sure how achieve it. when try below method, gives compilation error. please suggest correct approach ?

t getproviderclass(string customertype){          switch (customertype){             case "facebook":{                 return facebookapi.class;             }             case "google":{                 return googleapi20.class;             }             default:return null;         }     } 

instead of using t should this:

class<?> getproviderclass(string customertype) {      switch (customertype) {           case "facebook":{                return facebookapi.class;           }           case "google":{                return googleapi20.class;           }           default: return null;       }  } 

Comments