Skip to main content

L04 - Part 1

Patterns.java

public class Patterns {
    public static void main(String[] args) {
        for (int i = 0; i < 7; i++) {
            for (int j = 0; j < 7; j++) {
                if ((i + j) % 2 == 0)
                    System.out.print("X");
                else
                    System.out.print("_");
            }
            System.out.println(); // this is to move down a line after a row
        }
    }
}