boolean isLive = false;
This is the default value for a boolean variable. If you declare an instance variable, it is automatically initialized to false.
why is it assigned as false?
Well, we do this, just to start with the default value, then we can change the true value later, based on a certain condition.
if ((row >= 0 && row <= lastRow) && (col >= 0 && col <= lastCol)) { isLive = board[row][col]; } return isLive;
So, in the above code, if your if condition is false, then it is like returning false . Since the variable isLive does not change.
But if your condition is true, then the return value will depend on the value of board[row][col] . If it is false , the return value will be false , else true .
source share