Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes looping  problem with break and continue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "looping  problem with break and continue" Watch "looping  problem with break and continue" New topic
Author

looping problem with break and continue

chinnasamy vijayakumar
Greenhorn

Joined: Dec 02, 2000
Posts: 8
I found this problem with jdk 1.2.2 on RH LINUX VER 6.1
---------------------------
import java.io.*;
public class rectangle
{
public static void main(String args[])throws IOException
{
looping:
System.out.println("1 : update ");
System.out.println("2 : get area ");
System.out.println("3 : get circumference ");
BufferedInputStream b=new BufferedInputStream(System.in);
DataInputStream d=new DataInputStream(b);
System.out.println();
System.out.println();
System.out.println();
System.out.print("Enter the code : ");
String s=d.readLine();
int number=Integer.parseInt(s);

rect re=new rect();
if(number==1){
re.getdata();
continue looping;
}else
{if(number==2)
{
re.area();
}else
{
re.circum();
}
}

}
}
------------------------
The compiler says no label definition found

Why ?
vijay
Sivaram Ghorakavi
Ranch Hand

Joined: Nov 30, 2000
Posts: 56
labels (ex: loop should immediately be followed a looping for EX:
loop1:
while( i < 10 )
.....
OR
loop2
for(;
....
Hope this helps...
chinnasamy vijayakumar
Greenhorn

Joined: Dec 02, 2000
Posts: 8
Thanks Mr. Gorakavi
Its worked fine

bye.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: looping problem with break and continue