Give two differences between the switch statement and the if-else statement
Views 14
Answer:
switch | if-else |
---|---|
switch can only test if the expression is equal to any of its case constants | if-else can test for any boolean expression like less than, greater than, equal to, not equal to, etc. |
It is a multiple branching flow of control statement | It is a bi-directional flow of control statement |
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.