answersLogoWhite

0


Best Answer

Ends the case statement. Without it, any code after where the break; is supposed to be will get executed as well until it does encounter a break; or the end of the switch.

Code Example:

char cTest = 'a';

switch(cTest) {

case 'a':

/* Code here gets executed. */

case 'b': /

/* Code here gets executed. */

case 'c':

/* Code here gets executed. */

break;

case 'd':

/* Code here won't be executed. */

default:

/* Code here won't be executed. */

}

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

The break statement takes the flow of control out of the switch statement. Recall that each case element in the switch statement acts like a "goto" statement so, without the break statement, execution would simply continue to the next case. If that is what you intend, then don't use the break statement. Often, however, that is not what is intended, so break statements are necessary.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

In Java, if you don't want to break out of the switch code-block you could 'return' to exit the method with the switch statement.

char ch = getChar();

switch(ch) {

case 'a':

// do something

break;

case 'b':

// do something else

return;

....

}

// break resumes here

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

False. Java does not require break statements anywhere in a switch structure. You may, however, get a warning.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

The break statement when used in a switch takes the control outside the switch.
The control falls through all the cases unless the break statement is given.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

The break statement is used to close the switch statement. If you do not have the break statement the switch statement would keep going on.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

When the flow of execution passes through a break statement within a switch, execution passes to the statement that follows the switch.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: The break statement is required in the default case of a switch selection structure?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

The default base is always required in the switch selection structure true or false?

False. The Default section of a switch case section is not mandatory. the programmer can choose to have it if he wants to implement a default functionality in cases where none of the cases match the conditions.


What is the use of Default statement in switch case?

C++ Provides a multiple branch selection called as switch. This selection statement succesively test against a list of integer or character constants. When a match is found the statements associate with constants are executed. When no match is found default statement is used.


What optional statement can be used in a case structure to execute statements when all other conditions are false?

default : <statement>; i.e. switch (value) { case 1 : do_this(); break; case 2 : do_that(); break; default : do_whatever(); }


What does default mean in switch statement?

Default clause in switch statement used to indicate that the desired option is not available with the switch case statement. it is similar to else statement of if statement which is used when the condition does not satisfy.


What does mean selection in c program?

selection Also called a decision, one of the three basic logic structures in computerprogramming. The other two logic structures are sequence and loop.In a selection structure, a question is asked, and depending on the answer, the program takes one of two courses of action, after which the program moves on to the next event.This structure is sometimes referred to as an if-then-else because it directs the program to perform in this way: If Condition A is True then perform Action X else perform Action Y.All logic problems in programming can be solved by forming algorithms using only the three logic structures, and they can be combined in an infinite number of ways. The more complex the computing need, the more complex the combination of structures.

Related questions

The default base is always required in the switch selection structure?

yes,true


The default base is always required in switch selection structure true or false?

False. The Default section of a switch case section is not mandatory. the programmer can choose to have it if he wants to implement a default functionality in cases where none of the cases match the conditions.


The default base is always required in the switch selection structure true or false?

False. The Default section of a switch case section is not mandatory. the programmer can choose to have it if he wants to implement a default functionality in cases where none of the cases match the conditions.


What is the use of Default statement in switch case?

C++ Provides a multiple branch selection called as switch. This selection statement succesively test against a list of integer or character constants. When a match is found the statements associate with constants are executed. When no match is found default statement is used.


What are the types of data entry fields in GFEBS?

Required, Optional, Default, Conditional, and Selection


What are five types of data entry fields in gfebs?

Required, Optional, Default, Conditional, and Selection


What are the five types of data entry fields in GFEBS?

Required, Optional, Default, Conditional, and Selection


What optional statement can be used in a case structure to execute statements when all other conditions are false?

default : <statement>; i.e. switch (value) { case 1 : do_this(); break; case 2 : do_that(); break; default : do_whatever(); }


What does default mean in switch statement?

Default clause in switch statement used to indicate that the desired option is not available with the switch case statement. it is similar to else statement of if statement which is used when the condition does not satisfy.


How can you specify someone as your default approver?

When I select that person as an approver, select the Set Selection as Your Default Approver check box


How can specify someone as your default approver?

When I select that person as an approver, select the Set Selection as Your Default Approver check box


How do you get to the item selection on minecraft?

The default control to open your inventory is the E key