aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes break and contine in blocks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "break and contine in blocks" Watch "break and contine in blocks" New topic
Author

break and contine in blocks

Lokanadham Nalla
Greenhorn

Joined: Jul 21, 2005
Posts: 7
--------------------------------------
1)

block:
{
break block;
}
--------------------------------------
2)

block:
{
continue block;
}
--------------------------------------
1 is valid and 2 is invalid,

Can we apply break to block statements? Is it valid?
abhishek chauhan
Greenhorn

Joined: Jul 21, 2005
Posts: 8
a label break statement can be used to terminate any labeled statements that contains break statement .. this could be a normal block also where as the continue statement can only be applied to the loops
Alangudi Balaji Navaneethan
Ranch Hand

Joined: Apr 28, 2004
Posts: 42
break statement is used in loops and in switch statements normally.

When used in switch case, control come out of the switch after executing break statement. Continue statement cannot be used with swith ... case statements.

continue statement takes the control to the test portion of the loop after executing itself. Then the loop will continue its body or not based on the test result.


if you think you can you r right<br />if you think you can not you r double right
Arulkumar Gopalan
Ranch Hand

Joined: Oct 13, 2003
Posts: 104
continue can indirectly act as a break also... check the code below.



Anbudan & Mahalo,<br />Arul<br /> <br />-Not a sun certified Java professional :-)
 
wood burning stoves
 
subject: break and contine in blocks