+ 4

Explain when switch statements is used in Java?

I don't understand what is Switch Statement? When it is used in Java?

12th Apr 2018, 6:22 PM
Pradeep Anand
Pradeep Anand - avatar
3 Answers
+ 3
Thanks
12th Apr 2018, 6:39 PM
Pradeep Anand
Pradeep Anand - avatar
+ 1
using else if: if (...) {...} else if (...) {...} else (...) {...} using switch: swich (...) { case 1: ...; case 2: ...; ... } Switch statements are cleaner than else if statements if you have many choices.
28th Jun 2018, 5:11 AM
Kev
- 2
never
3rd Aug 2018, 5:52 PM
Robert Young
Robert Young - avatar