switch is a multi-way branch construct: it selects one of several paths based on the value of a variable. Java has three forms of switch: the classic statement, the modern expression, and switch with Pattern Matching.
Classic switch Statement
switch is a multi-way branch construct: it selects one of several paths based on the value of a variable. Java has three forms of switch: the classic statement, the modern expression, and switch with Pattern Matching.