What is the low level mechanism for switch statements? [duplicate]

This question already has an answer here:

I am interested in how switch statements in languages work and if there is any difference to using a string of if-else cases. Is there any difference in the underlying workings (with respect to Assembly code) of those or is it just to make it easier to read?

For example:

public void processInput(int num){
    switch(num):
        case 1:
        //process case 1
        case 2:
        //process case 2
}


Source: java

Leave a Reply