If you are currently working through the CodeHS Java (or JavaScript) curriculum, particularly the unit on Nested Loops or 2D Arrays, you have likely encountered the infamous exercise: 9.1.7 Checkerboard V2.

At first glance, this problem seems simple: draw a checkerboard. But the "V2" designation introduces specific logic constraints that often trip up students. This article will break down the problem, explain the underlying logic of nested loops and modulus operators, provide step-by-step code solutions in both Java and JavaScript, and offer debugging tips to help you pass the autograder on your first attempt.

Once you pass 9.1.7, you are ready for real applications. The checkerboard pattern is everywhere:

You can try modifying your solution:


The goal is typically to draw an 8x8 checkerboard with alternating black and red squares (or another color pair).