Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > Java

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 03-21-2016, 01:54 AM   #1
Shivangi Panwar
Registered User
 
Join Date: Nov 2015
Posts: 127
What’s the purpose of using Break in each case of Switch Statement?

What’s the purpose of using Break in each case of Switch Statement?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Shivangi Panwar is offline   Reply With Quote

Old 03-21-2016, 01:56 AM   #2
Kunal
Registered User
 
Join Date: Feb 2016
Posts: 73
Break is used after each case (except the last one) in a switch so that code breaks after the valid case and doesn’t flow in the proceeding cases too.

If break isn’t used after each case, all cases after the valid case also get executed resulting in wrong results.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Kunal is offline   Reply With Quote
Old 03-23-2016, 06:01 AM   #3
aajokhio
Registered User
 
Join Date: May 2015
Location: Hyderabad/Pakistan
Posts: 25
Basically, Break statement stop a program, and after break statement, any program does not display.
aajokhio is offline   Reply With Quote
Old 06-06-2016, 10:40 PM   #4
SaraSanjay
Registered User
 
Join Date: May 2016
Posts: 551
The break statement to end processing of a particular case
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
SaraSanjay is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Making the best thesis statement Yemers General Discussion 5 09-13-2017 10:57 PM
How To Choose The Right Lawyer For Your Case? nelsontwain Making money on the web 1 12-31-2013 01:21 AM
What’s spam indexing? sinicline Google 1 07-17-2013 05:24 AM
Looking for a new case or cover to protect your new MacBook Air? sophia21 General Discussion 0 10-31-2012 10:52 PM


All times are GMT -7. The time now is 02:24 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.