Switching on non-Ints in Java
<p>I'm having trouble figuring out the inner workings of switches in Java
I'm told that for all primitives, the value is promoted to a Integer. </p>

<p>However, in the following example, I'm testing on a byte variable, and any case larger than 127 will not compile:</p>

<pre><code>byte k = 5;
switch(k){
  case 128:    //fails to compile, possible loss of precision  
</code></pre>

<p>I realize this is an error and have no issue with that. My question is:<br>
How does the JVM track that it's switching on a byte if it takes the value of "k" and promotes it to an integer before testing each case?</p>
