On the move:

I'm currently moving the following to their own blogs: Unix, HTML for Blogs, Perl & Java.
The links are on the left side.

Thursday, October 9, 2008

Java - Loops

FOR LOOP
    for (int k=0; k < 3; k++)
{
s1.readData();
}


WHILE LOOP
    int k = 0;
while (k < 3)
{
s1.readData();
k++;
}


INFINITE LOOP
   for (;;)
{
s1.readData();

System.out.printf("Continue? Y/N ");
answer = userInput.nextLine();
if (answer.equalsIgnoreCase("y")) continue; else break;
}

No comments:

Post a Comment