I had problems figuring out the internal operation of the switches in Java. They told me that for all primitives, the value is raised to a whole.
However, in the following example, I am testing a byte variable, and any case greater than 127 will not compile:
byte k = 5; switch(k){ case 128:
I understand that this is a mistake, and I have no problem with this. My question is:
How does the JVM track that it includes a byte if it takes a value of "k" and advances it to an integer before testing each case?
source share