I'm creating a function in Java that returns the type of the variable and as such, since I'm trying to figure out its type, I have no way of telling the function what type of variable to expect.
What I'm trying to build is the following:
public String getVarType(AnyType var){
if (var instanceof ArrayList) {
return "ArrayList";
}
if (var instanceof String) {
return "String";
}
}
How can I set the parameters for the function to expect any type?