0

Quite recently, I studied about nested loop for object oriented programming (Java). During the learning process, I got some sort of error. To clarify, there are no red lines that indicate errors in my code lines.

public class BASIC_NestedLoops {

public static void main(String[] args) {
    
    for(int i = 0; i < 2; i++) {
        System.out.println("Panas gila ~~~");
    }
    
    System.out.println("- - - - - ");
    
    String[] colors = {"Black", "Red", "Yellow",};
    
    for(int i = 0; i < 5; i++) {
        System.out.println(colors[i]);
    }
    
    System.out.println("- - - - - ");
    
    String[][] fancycolors = { {"Black", "Red", "Yellow",}, {"Cyan", "Magenta", "Turquoise",}
    };
    
    for(int row = 0; row < 2; row++) {
        for(int column = 0; column < 3; column++) {
            System.out.println(fancycolors[row][column]);
        }
    }
    
    System.out.println("- - - - - ");
    
    for(int x = 0; x < 2; x++) {
        for(int y = 0; y < 3; y++) {
            System.out.println("x = " + " , y = " + y);
        }
    }

}

}

After I debug, the output tab gives this message.

enter image description here

I feel like I'm missing something somewhere in the code. I'm currently stuck at this so if anyone could lend a hand or teach me on this, I'd really appreciate it. Thank you. - Coding noob

YN27
  • 33
  • 6

0 Answers0