I'm currently doing coding online to learn coding and am doing the Battleship problem. In this problem you're given methods and the parameters they accept in code.
I am stuck on a problem where the user inputs a row and column and the code verifies whether a row and column were inputted.
// Has the location been initialized
public boolean isLocationSet()
{
if(row == null && col == null)
{
return false;
}
return true;
}
The error I get says: Incomparable types int and (it cuts off but I'm assuming it means null or boolean)
How would I be able to say, if the expected ints row
and column
are empty then return false, otherwise return true?