Computer Science Canada

Boolean help

Author:  romantic_programmer [ Wed Jan 10, 2007 3:54 pm ]
Post subject:  Boolean help

I am Still new to java and don't under stand to to get booleans to work. if some one gold give me an example with it in an if statement i would greatly appreciate it. I looked in the tutorials and i seen examples but still cant see how it works...

Thank you...
Romantic Programmer

Author:  ericfourfour [ Wed Jan 10, 2007 9:29 pm ]
Post subject:  Re: Boolean help

I'll provide you with a few examples of situations where booleans are used.

Java:
boolean experiment () {
    boolean status = false;
    status = true;
    if (status) {

    }
    while (!status) {

    }
    status = "Hello".equals("World");
    status = 1 == 1;
    status = 5.2 > 10.21;
    status ? 5 : 3;
    System.out.println (status);
    return status;
}


Finally, you could always google boolean and I bet you will be provided with many tutorials on booleans.

Author:  romantic_programmer [ Sun Jan 14, 2007 4:38 pm ]
Post subject:  RE:Boolean help

thank you, This is a great example... very helpful...


: