Why are boolean variables useful for if statements and loops?

What will be an ideal response?


Boolean variables evaluate to either true or false, and the if and loop conditions also evaluate to true or false. The Boolean variable is handy because you can write an if statement like this:
if(bGood) where bGood is either true or false).

Computer Science & Information Technology

You might also like to view...

Name the two kinds of items that are contained in a class:

What will be an ideal response?

Computer Science & Information Technology

Answer the following questions true (T) or false (F)

1. True/False: Suppose MyNumber = 6 . Is the following expression True or False? (2 * MyNumber – 4 > 6 ) AND (MyNumber < 10) 2. True/False: If A = 20 and B = 15, then both of the following statements are True: A > B and B <= A 3. True/False: The type of operators that are evaluated second in the hierarchy of order of operations are logical operators.

Computer Science & Information Technology

Which of the following statements is true?

A) The CompareTo method is implemented by the String class B) The CompareTo method is implemented by all the subclasses of the Number class C) The Comparable interface is defined in the Java class libraries D) All of the above statements are true.

Computer Science & Information Technology

When changing fonts using the Mini toolbar, ________ is not available

Fill in the blank(s) with correct word

Computer Science & Information Technology