0

When I run this code on Netbeans IDE v11.1

         for(int x = 3; x >0; x--)
             for(int y = 3; y >= x; y--) {
                 System.err.println(x + "  " + y);
                 if(x == 1 && y == 2) { // any if statement
                    System.out.println("KKKK");
                    return;
                 }
             }

The "KKKK" should be at the end of the output so the expected output is :

    3  3
    2  3
    2  2
    1  3
    1  2
    KKKK

But what i get in netbeans is

    3  3
    KKKK
    2  3
    2  2
    1  3
    1  2

And the position of "KKKK" changes randomly in the output

What happens?

Omar_Hafez
  • 272
  • 2
  • 13

0 Answers0