I don't know what's wrong with the following code. I keep getting the error: ']' expected

Why can't I use boardsquare[k] and set it equal it to a graphic? What am I doing wrong?

Thank you so much for your time and suggestions!

int k = 9;
        Piece[] boardSquare = new Piece[k];
        
        
         boardSquare[0] = new Piece (25, 50, 50, 50, "lightGray", true, "1", "Square");
         boardSquare[1] = new Piece (80, 50 , 50, 50, "lightGray", true, "2", "Square");
         boardSquare[2] = new Piece (135, 50 , 50, 50, "lightGray", true, "3", "Square");
         boardSquare[3] = new Piece (25, 105 , 50, 50, "lightGray", true, "4", "Square");
         boardSquare[4] = new Piece (80, 105 , 50, 50, "lightGray", true, "5", "Square");
         boardSquare[5] = new Piece (135, 105 , 50, 50, "lightGray", true, "6", "Square");
         boardSquare[6] = new Piece (25, 160 , 50, 50, "lightGray", true, "7", "Square");
         boardSquare[7] = new Piece (80, 160 , 50, 50, "lightGray", true, "8", "Square");
         boardSquare[8] = new Piece (135, 160 , 50, 50, "lightGray", true, "9", "Square");

I don't find anything wrong in this piece of code. Post more code and the entire error trace to let us know more.