equals method; consequently, the comparison of String objects in switch statements is case sensitive . The Java compiler generates generally more efficient bytecode from switch statements that use String objects than from chained if-then-else statements.