Results 1 to 4 of 4
  1. #1
    matzahboy is offline Member
    Join Date
    Nov 2008
    Posts
    67
    Rep Power
    0

    Default [SOLVED] break statements

    I have 2 questions concerning them.

    1. What kinds of things can they break out of? Is it only for and while statements?

    2. If I have a nested loop, do I have to use 2 break statements (one for each loop) to get out of both?

  2. #2
    troysmith is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Default

    Hi guys hows it goin, this is my first ime here

  3. #3
    matzahboy is offline Member
    Join Date
    Nov 2008
    Posts
    67
    Rep Power
    0

    Default

    troysmith, the place for that kind of post is the "introductions" forum

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    As per usual, the tutorials are the first place to go. Look at this: Branching Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)

    There you'll find this quote and more:
    An unlabeled break statement terminates the innermost switch, for, while, or do-while statement, but a labeled break terminates an outer statement.
    As always, the best way to test this is to run this for yourself.

    Good luck.

Similar Threads

  1. Misunderstanding of Break
    By Steve Whalen in forum New To Java
    Replies: 6
    Last Post: 10-22-2008, 06:31 PM
  2. Break to certain class
    By Arez in forum New To Java
    Replies: 4
    Last Post: 10-20-2008, 04:13 AM
  3. Break Clock
    By BruenorBH in forum Advanced Java
    Replies: 20
    Last Post: 09-12-2008, 05:27 AM
  4. How to use Break with a label
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:45 PM
  5. How to use Break
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •