Q. What is the primary purpose of the break statement?

A
To exit a loop or a switch block immediately
B
To skip the current iteration of a loop and continue with the next
C
To end the entire program
D
To return a value from a method
Solution:

The break statement terminates the nearest enclosing loop (for, while, do-while) or switch statement.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!