Back to Browse

Java switch statement

15.9K views
Apr 8, 2017
17:58

Java tutorial for beginners playlist https://www.youtube.com/playlist?list=PL6n9fhu94yhWizLudXueXf16yJzlwNrSc Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1 Switch statement in java provides a way to select one of the many different actions. You must use a break statement after each case block to keep execution from faillng through remaining test cases. If multiple cases need to have same action, then they can be stacked together Switch statement rules 1. Multiple case labels but only a single default label. 2. Default label executes when no matching value is found in the case labels. 3. Use break statement to exit a switch case 4. Without break it will just fall through 5. Prior to Java 7, switch control expressions could be integer/character only. Now, String objects are allowed 6. Case statements are executed in sequential order. 7. Use if-else statement when test expressions are based on ranges of values or conditions 8. Use switch to improve readability and where test conditions are based on single integer, enumerated type or string object

Download

1 formats

Video Formats

360pmp424.5 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Java switch statement | NatokHD