This content has been marked as final. Show 4 replies
Why? It's statically typed. It can't change from what you said when you declared it (unlike an Object reference).
obi v wrote:At first: use proper naming!
I would like to find out how to tell if a variable is of a primitive type such as int, float, boolean or char from my program.
Choose names that let you easily guess the type and dimesion of your variables (e.g. lenghInInch, isAvailable or numberOfTries ).
At second: Could you please describe what you are trying to do?
IMHO there are onlye rare cases where it is usefull to programatically determine the type of a method parameter (and never for (member) variables). And especially with a primitive type I can't see any use case.
And especially with a primitive type I can't see any use case.There can't be a use case because there is no way of implementing it.
Many thanks guys......such a functionality is really only applicable in dynamically typed languages as your contributions have explained......! Cheers.