Why are we allowed to assign char to a int in java?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8549692/char-and-int-in-java">char and int in Java</a>  </p>
</blockquote>



<p>AsicII table :http://www.asciitable.com</p>

<p>The code below print out the Dec value of the corresponding char, for example "123" -> 49 50 51</p>

<pre><code> public void foo(String str)
        {
            for(int x = 0; x &lt; str.length(); x++)
            {
                int temp = str.charAt(x);
                System.out.println(temp);
            }
        }
</code></pre>

<p>But I notice java is a strong type language, which mean every thing has to be cast in compile time, but how come the code knows how and when to convert char into the correct Dec value in AsicII table?
Did I mess up any of the java/programming fundamental?</p>
