Good day. I’m new to java and I wanted to do some ASCII art to introduce myself to things like loops and methods since some of the patterns will repeat. I’m trying to create a checkered pattern that looks like this:
** ** **
** ** **
** ** **
** ** **
I was able to complete the top row with this code:
public static void squares(){
for (int i = 0; i <= 4; i++){
System.out.print(" ***\t***\t");
}
System.out.println("");
/* //Commented out since this is where the issue comes in
for (int i = 0; i <= 4; i++){
System.out.print("***\t***\t ");
}
System.out.println("");
*/
}
public class ASCIIART{
squares();
}
I thought doing the opposite of the top would crate the checkerboard pattern but it messes up the neat row of squares that I completed. How can I fix this?