How to check variable type in java?
For example, the variable i given, and after calculating and casting, I want to know what data type this variable was eventually brought to.
How to check variable type in java?
For example, the variable i given, and after calculating and casting, I want to know what data type this variable was eventually brought to.
When you declare, you specify the type of the variable and this type remains unchanged during the execution of the program.
For example:
int x = 10; However, you can do this:
double y = x; That is, assign the value of the variable x to the variable y with the type cast from int to type double .
But the variable x as was of type int , remains.
Source: https://ru.stackoverflow.com/questions/420430/
All Articles