c.getCollectibles()[i][j].isCollected() ? collectiblePanels[i][j].setSplash(c.getCollectibles()[i][j].getIcon()) : repaint();
I am writing a program in Java and have an error in my program. I am using a conditional operator. c.getCollectibles() returns a two-dimensional array of a Collectible class, and isCollected() is a non-static public method in the Collectible class that returns a boolean value.
collectiblePanels is a two-dimensional array of a class that contains a setSplash() method. The setSplash() method takes in the same type that getIcon() returns (the specifics are irrelevant to the error). Overall, setSplash() is void.
repaint() is a random void method. Again, specifics are irrelevant to the error.
The specific error is below:
The left-hand side of an assignment must be a variable
Syntax error on token "?", invalid AssignmentOperator
Syntax error on token ":", ; expected