Today's Question:  What's your opinion about Alibaba mooncake incident?        GIVE A SHOUT

  WRITE ARTICLE

 ALL


  A boolean value interview question

Someone asked a question on StackOverflow, he was asked an interview question. The question is : Given 3 boolean variables a, b, c, return true if at least 2 out of the 3 are true. He gave the solution as follows :boolean atLeastTwo(boolean a, boolean b, boolean c) {    if ((a && b) || (b && c) || (a && c)) {        return true;    } else {        ret...

3,848 0 0          RETURN EXPRESSION BOOL CONDITIONAL