Java Learning Made Easy by Dheeraj Mehrotra - HTML preview
PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.
Download the book in PDF, ePub, Kindle for a complete version.
SWITCH / IF-ELSE



i). The IF-ELSE statement is used for manipulating multiple conditions


whereas SWITCH touches upon only one conditional variable. And different

values of the variable passes the control to the required case.


(ii). The IF-ELSE statement uses both integer as well as floating type values
whereas the SWITCH statement only accepts integer values.



(iii). In SWITCH statement all the branches or compound statements are

executed depending on the value of the same variable on the other hand

IF-ELSE follows usage of long instruction based statements and may create confusion within blocks.













attention@computerscienceexpertise.com




























