It is a Conditional operator also known as Ternary operator. It is simply the compact form of if else statement wherein you don't have to use if and else separately.
Here's how it works...
"?"- anything written before the"?" is the condition
":"- anything written before the ":" is chosen as the result if the condition mentioned before "?" is true
anything written after the ":" is chosen as the result if the condition mentioned before "?" is false
This is how it works...
So splitting the given code into if/else can be easily done as follows -
if (row <= -1 || row == rows || col <= -1 || col == cols) {
return false;
}
else {
return lifeBoard[row][col];
}