break : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

break
Modem Break Switch Break
Loop Break Links

Modem Break

When a modem desperately wants to gain the attention of the other modem, it can send a long string of 0s, perhaps 250 milliseconds — a quarter of a second. This is a pattern that could never occur naturally in data because it is lacking start/stop bits. Break usually means "Hold everything, stop the world, I want to get off.".

Loop Break

break is also a keyword in Java that lets you leap out of a loop or out of nested loops when it is used with a label. It is also used to terminate the code for a case in a switch.

Traditional wisdom has it that goto is extremely wicked. goto is a reserved word in Java, but it is also illegal. But you need it in a few situations, e.g. to jump to the end of a loop and to jump out of a loop.

break jumps just past the end of the current loop (for or while). In contrast continue jumps to the end of the current loop, and goes around again.

If you use a name after the break e.g. break outer; it will jump just past the end of the loop named outer: (Look for the label at the top of the loop). If you use a name after the continue e.g. continue outer; it will jump to the end of the loop named outer:.

You can jump out of nested loops, but you cannot jump in.

Switch Break

Normally each case or group of cases with a common action, you terminate the action with break. That jumps to the end of the switch. If you accidentally forget the break, it will fall through to the next case action, nearly always not what you intended.


This page is posted
on the web at:

http://mindprod.com/jgloss/break.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\break.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
no blog for this page
IP:[65.110.21.43]
Your face IP:[54.81.166.199]
You are visitor number