History, asked by Anonymous, 1 year ago

Hey mates...
Give the difference between SWITCH and IF-ELSE in java....

Answers

Answered by prachitayade
0
I hope this will help you
Attachments:
Answered by Anonymous
1
Hyyyy ●Madhu●✅✅

◆◆◆◆◆◆

 <br />{\huge \star {\orange {Here\: Is\: YourAns}}}

❤️Differences Between if-else and switch❤️

&lt;a&gt;&lt;b&gt;&lt;i&gt;

⏭️Expression inside if statement decide whether to execute the statements inside if block or under else block. On the other hand, expression inside switch statement decide which case to execute.

⏭️If-esle statement checks for equality as well as for logical expression . On the other hand, switch checks only for equality.

⏭️The if statement evaluates integer, character, pointer or floating-point type or boolean type. On the other hand, switch statement evaluates only character or a integer datatype.

⏭️Sequence of execution is like either statement under if block will execute or statements under else block statement will execute. On the other hand the expression in switch statement decide which case to execute and if you do not apply a break statement after each case it will execute till the end of switch statement.

⏭️If expression inside if turn outs to be false, statement inside else block will be executed. If expression inside switch statement turn out to be false then default statements is executed.

⏭️It is difficult to edit if-else statements as it is tedious to trace where the correction is required. On the other hand it is easy to edit switch statements as they are easy to trace.
in one word we can say switch acts a little bit faster than if else statement!!

___________________✔️✔️✔️✔️✔️
_______________%%%%%%%%%%%%%%%%%

&lt;marquee &gt;

\large{\red{\boxed{\mathbb{Hope\: It\: Helps}}}}

❤️❤️Thanks For❤️❤️
✨✨Kiran✨✨
Similar questions