Is it possible to check if a char has been passed into a method that requires an int?
For example, if you have some function foo(int bar) and someone uses that function like foo(‘t’),
are you able to find out that a char was inputted and not an int?
I know that the char is converted into an int but I am trying to limit anything other than pure integers getting through the function.
Cheers
You can use Integer instead of int.
If you try to invoke foo(‘A’) you will get a compiler error.