- 1
How to convert a character value into an integer
9 Respostas
+ 5
Integer.valueOf('6') == 6?
+ 4
But you can convert characters by integers of the same digits only by subtracting 48.
'6' - 48 == 6
+ 4
you can cast the character to int
this actually happens when you subtract 48 ...
((int)'6') - 48 == 6
+ 2
Naman Pandey No, it seemed to be wrong.
+ 2
char myChar = 'C';
int converted = (int) myChar;
System.out.print(converted);
Output:
67
Or subtract if you have a digit
+ 2
HNNX 🐿 'c' == 99, 'C' == 67
+ 1
Yes,it is not working properly
+ 1
Seb TheS fixed :)
0
Thanks