Changing Variable Type in Java Arithmetic Operations:
It is not possible to assign a variable from one variable type to another variable directly from java.
char a = 'x';
int b = a;
In java, this process gives an error. But if it is written as follows, the process takes place.
char a = 'x';
int b = (int) a;
so it can convert all values. however, extreme caution should be exercised in doing this. Some values may be lost during this conversion, some values may change. care should be taken for this.
Tagged In:
Java