Single Choice
Moderate
QHow can a for loop be prematurely terminated in Java?
ID: #23080
For Loop in Programming Language
101 views
Question Info
#23080Q ID
ModerateDifficulty
For Loop in Programming LanguageTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
In Java, the break statement is used to prematurely terminate a loop. When a break statement is encountered inside a loop, the loop stops executing, and control is passed to the first statement following the loop. The return statement is used to exit a method, while continue skips the current iteration but does not terminate the loop. exit() is used to terminate the program, not a loop.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic