Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

AP CSA Question of the Day April 28, 2025

Reference
  1. Incorrect Correct No Answer was selected Invalid Answer

    What will this code return given checkMethod(false, false)?

    public int checkMethod(boolean x, boolean y)
    {
        if(!x)
        {
            if(y)
            {
                return 0;
            }
            else
            {
                return -1;
            }
        }
        else
        {
            if(y)
            {
                 return 1;
            }
            else
            {
                  return 2;
            }
        }
    }
    Java