What is the code doing exactly and what is the theoretical reason why this code is not compiling? (part 2)

Please see below some java code which I am trying to compile and run. I am fully aware that the code has an error. I also know how to fix it (as you can see from the comment just below). What I don't however know is what this code is actually doing.
Is it looping infinitely? Does it stop abruptly? What is the exact reason behind why I get a compile error (interrupted because taking more than 5 secs to run)?

import java.util.Random;

public class PartA {

	//loop 10 times
	private static void loop3() {
		int i = 0;
		do {
			System.out.println("In loop "+i);
              		//i++;
			} while(i < 10);
			System.out.println("Out of loop");
		}

        private static void runLoops() {
		loop3();
		System.out.println();
	}


	public static void main(String[] args) {
		runLoops();
	}

}

Open in new window


thanks in advance
badwolfffAsked:
Who is Participating?
 
David Johnson, CD, MVPConnect With a Mentor OwnerCommented:
You commented out the increment of i so the test for i < 10 will always be true
0
 
CEHJCommented:
What is the exact reason behind why I get a compile error
You don't get a compile error
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.