title: Adding and subtracting chars, why does this work?
body: <p>I’m learning Java through &quot;introduction to Java programming 9th edition&quot; by Daniel Liang at chapter 9 &quot;strings&quot; I’ve encountered this piece of code :</p>
  <pre><code>public static int hexCharToDecimal(char ch) {
     if (ch &gt;= 'A' &amp;&amp; ch &lt;= 'F')
         return 10 + ch - 'A';
     else
        return ch - '0';
  }
  </code></pre>
  <p>Can someone explain what just happened in here? How is possible to add/subtract chars from integers and what's the meaning behind it?</p>