In Java I know you can convert char to ints like so:
int c = (int) msg.charAt(i);
But why does this also work with no errors:
int c = msg.charAt(i);
the function returns an int, so surely it needs to be "cast" to an int before using it.
DUPLICATE: Although the answer given by: Why are we allowed to assign char to a int in java? , the qusestion is slightly different. As I was not asking why we can assign a char to an int, rather I was asking why no cast is necessary. I'll suggest to keep this open for people on Google, even though its the same answer!