I have declared a method that return Class
, but i don't know if it is the right way or not .
When i pass int
, float
, double
or String
as parameter, i want to return int.class
, float.class
or double.class
.
How can i do that?
Class<?> analyseType(String nameType) throws ClassNotFoundException {
Class<?> classe = Class.forName(nameType);
return classe;
}