File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes  Consider this code. 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 " Consider this code." Watch " Consider this code." New topic
Author

Consider this code.

Sanket Modi
Ranch Hand

Joined: Mar 10, 2008
Posts: 30
Consider this code.
public class Test {
public static void main(String[] args){
for(int j = 0; j < 1 ; j++)
{
if (j < 1) continue innerLoop;
innerLoop: for(int i = 0; i < 2; i++)
{
System.out.println("Hello world");
}
}
}
}
What is the result of attempting to compile and run this.


Thanks and regards,<br />SanKet Modi
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Sanket Modi:
... What is the result of attempting to compile and run this.

Fortunately, Sun provides free tools (javac and java) for testing this.

Do you have a Java JDK installed on your machine?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Gaurav Joshi
Greenhorn

Joined: Mar 08, 2008
Posts: 18
Hi Sanket Modi,





The above code will not complie as Label are like identifiers and the statement using these label(break or continue) must be in the scope of the label
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Consider this code.