In the computing world characters are mapped/coded to numbers trough various encoding schemes depend on the language on hand.
Java utilize the
UTF-16 encoding scheme
what happens in
is called
implicit type conversion let's examine it
Java is a
strong typed language . Every entity in Java have to have a type.
A type is a set of permissible values and a set of permissible operations that operate on that values. That is enforced by the compiler if you use a non valid value or operation
the compiler complains and not compile your code
You have declared the variable a as type integer that means the variable a can take only integer values like ...-1,0,1... but you give it a value of type char instead.
NOTE
Normally if the type on the right hand side of an assignment is not equal(more correctly compatible) to the type on the left hand side the compiler raises an error and not compile
because you're out of the type compatibility rules. That's a characteristic of all strong typed languages and even if can be seemed hard to you the prime times help much to avoid
errors that have to be raised at run time. imagine a critical situation such as an such error in an nuclear plant would be catastrofic
Now turn in us because char and int are compatible types the compiler doesn't complain instead help you in hiding your error(correctly you had to declare a of type char if you intend
to assign it a character such as '7') in transform your character '7' in an integer that corresponds in an int i.e. 55 on the UTF-16 conversion table