Loops 对角递增 if(shape.equals(“对角线”)){ 对于(int row=0;row

Loops 对角递增 if(shape.equals(“对角线”)){ 对于(int row=0;row,loops,increment,Loops,Increment,尝试替换 if (shape.equals("diagonal")){ for (int row = 0; row <= size; row ++){ for (int col = 0 ; col < size; col ++ ){ if ( col % 4 == 0 ){

尝试替换

        if (shape.equals("diagonal")){
                    for (int row = 0; row <= size; row ++){
                        for (int col = 0 ; col < size; col ++ ){

                            if ( col % 4 == 0 ){
                                System.out.print("*");
                            } else {
                                System.out.print("$");
                            }
                        }
                        System.out.println();
                    }
                }



*$$$*$$$*$$$*$$$*
$*$$$*$$$*$$$*$$$
$$*$$$*$$$*$$$*$$
same as it go down


根本不清楚你在问什么
if (col % 4 == 0 )
if ( (col+row)%4 == 0 )