Question: I was studying a book and I found this :

```
int tiles = ch - 'A';

```

where `ch` is a character.

What I dont understand is how did operating between two characters result an integer?

Answer: 
As you can read [here](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html):

> 
> char: The char data type is a single 16-bit Unicode character. It has
> a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or
> 65,535 inclusive).
> 
> 
> 

So we can see, that internally a char is stored as a numeric value. And, as you can read [here](http://www.particle.kth.se/%7Elindsey/JavaCourse/Book/Part1/Java/Chapter02/operators.html)

> 
> char, when in numeric operations is treated as an unsigned two byte
> integer
> 
> 
> 

Also, in the [oracle docs about conversion](http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.2), we can see that char to int is one of the Widening Primitive Conversion, along with:

* byte to short, int, long, float, or double
* short to int, long, float, or double
* char to int, long, float, or double
* int to long, float, or double
* long to float or double
* float to double

and, [more references](http://www.cs.cmu.edu/%7Epattis/15-1XX/15-200/lectures/voe/lecture.html#ImplicitConversion):

> 
> Java will automatically convert a char value into an int value (and
> vice-versa) if necessary.
> 
> 
> Java performs one other implicit conversion when necessary: a char is
> implicitly converted to an int (according to its value in the ASCII
> table). So in 'A'+1, the char 'A' is first implicitly converted to the
> int 65 so that it can be added to the int 1 finally producing an int
> result of 66. In fact, in the expression 1.5+'A', 'A' is first
> implicitly converted to the int 65 and then implicitly converted to
> the double 65. finally producing an double 66.5 as a result.
> 
> 
> Finally, the expression '5'-'0' implicitly converts both char values
> to int (53 and 48 respectively: see the ASCII table) and then performs
> subtraction: the result in this case is the int 5. In fact, if we
> declare char d = '8'; (or any other character that is a digit), then
> writing d-'0' results in an int equivalent to the digit (in this case
> 8). Note that the ASCII value of '8' is 56 and of '0' is 48.
> 
> 
>
Every character has an ascii value (an integer). In other words, every character has a number that represents it. Doing the operation 'ch - A' will yield you with a number between 0 and 26, assumming 'ch' is between A and Z.