Can we pass two parameters in switch case in Java?

Anyway. Second, the only way to use switch with multiple variables is to combine them into one primitive (string, number, etc) value: var stateA = “foo”; var stateB = “bar”; switch (stateA + “-” + stateB) { case “foo-bar”: … … }

Sizin İçin Seçtik  Is switch case better than if-else Java?

Leave a Reply

Your email address will not be published. Required fields are marked *