File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "error" Watch "error" New topic


jioy uilo

Joined: Mar 29, 2003
Posts: 25
why error in the line after 12:
public static void main(String[] args) {
int counter = 0;
for (int i=0; i<10; i++) {
int j = 0;
while (j++ < 10) {
if (j > i) break l2;
if (j == i) {
continue l1;
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
There cannot be intervening sentences bewteen a label an the loop it marks. That is "l2:" and "int j =0" have to be swapped.
Please ident your code using UBB.
[ May 23, 2003: Message edited by: Jose Botella ]

SCJP2. Please Indent your code using UBB Code
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1090
One thing more there can not be a label on a variable declaration.
Brian Joseph
Ranch Hand

Joined: May 16, 2003
Posts: 160
So where are all the legal positions for a label? In my book I only see it being applied on the same line as the loop construct.
I agree. Here's the link:
subject: error
It's not a secret anymore!