Debug the counter

Report a typo

Create a file Counter.java and copy the following code into it:

class Main {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            System.out.println(++i);
        }
    }
}

Set a breakpoint at the line "System.out.println(++i)" and debug the main method. What are the values of the variable "i" when the debugger stops at this line?

Select one option from the list
___

Create a free account to access the full topic