How to test a boolean?

Posted by – July 29, 2010

This is some of the best written code I have ever seen or I will ever see

public boolean isBooleanFalse(boolean value) {
   boolean response = false;
   if (value == true) {
       response = false;
   } else {
       response = true;
   }
   return response;
}

I bet no one can do better than this.

3 Comments on How to test a boolean?

  1. Sukhbir says:

    Haha. Reminds me of this:

    #define TRUE FALSE

    :P

  2. Anonymouse says:

    What about this?

    public boolean isBooleanFalse(boolean value) {
    boolean response = false;
    if (value == true) {
    response = false;
    }
    return response;
    }

  3. Anonymouse says:

    What about this?

    public boolean isBooleanFalse(boolean value) {
    boolean response = true;
    if (value == true) {
    response = false;
    }
    return response;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>