Though a switch statement can be represented as a series of if statements, it appears that when a Java switch statement is compiled into bytecode, a different approach is used.
Read the spec . In Java, if you code a switch statement, then depending on various things the switch is converted into a tableswitch instruction in bytecode. Essentially a jump table. What the bytecode looks like may be irrelavent though, if the JIT can optimize it into something more efficient. This is of course, platform dependent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With