Single Choice
Easy
QThe statement to stop the execution of a construct
ID: #22236
switch case in Java
101 views
Question Info
#22236Q ID
EasyDifficulty
switch case in JavaTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
To stop the execution of a construct, such as a loop or a switch statement, the correct statement is:
b) break
Explanation:
-
break: This statement is used to exit from a loop (likefor,while, ordo-while) or aswitchstatement. Whenbreakis encountered, the execution of the loop or switch construct is immediately terminated. -
System.exit(0): This terminates the entire Java Virtual Machine (JVM), not just a single construct. -
stop: This is not a valid Java statement for stopping execution. -
end: This is not a valid Java statement for stopping execution.
Correct Answer:
b) break
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic