This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes break and contine in blocks Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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 :-)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: break and contine in blocks
 
Similar Threads
JQ+ Question on break and continue
Question from Khalid & Rolf
is it a valid jsp code
debuging a static block
try, catch and finally