I would like to pass a data type into a method but I can’t seem to find a data type for data types, I’m not sure what to do
So when I refer to data type I refer to the part before declaring a variable, for example: int myNumber;
I would like to pass the type, so the method could take string or int and recognise it as the data type rather than a string, instead of using switch cases for each primitive data type
I will use the method to keep validating inputs, instead of try, except
Basically, I’m asking what the following underscore is:
_____ variable1 = String;
variable1 variable2 = “Words”;
And if there is a way to take a generic input using a scanner rather than specifying a data type, or to specify the data type using variable1