Program that uses break as a civilized form of goto

/* Program that uses break as a civilized form of goto */

class BreakDemo3
{
    public static void main(String args[])
    {
        boolean b = true;

        FIRST: {
            SECOND : {
                THRID : {
                      System.out.println("Before break....");
                      if(b) break SECOND ; //break out of second block
                      System.out.println("This won't execute....");
                    }
                    System.out.println("This won't execute....");
                 }              
              System.out.println("This is after SECOND block....");
            }
    }
}

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|