Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 32
at chess.StartBoard.finalBoard(StartBoard.java:74)
at chess.Play.main(Play.java:21)
Looks like you went past the end of the array, viz, element index 31, on
line 74 in your code.
// These
//StartBoard[] try2 = new StartBoard[32];
//try2 = StartBoard.finalBoard(); // line 21 here?
// can be written
StartBoard[] try2 = StartBoard.finalBoard();
// This looks okay.
for (int i = 0; i<32; i++)
System.out.println(try2[i].getType());
...
public enum StartBoard {
static public StartBoard[] finalBoard()
{
StartBoard[] temp = new StartBoard[32];
.
.
// line 74 must be in here...
.
return temp;
}