Boolean Fumbles
This program excerpt helps the user to make good use of
boolean type.
Download files: BooleanFumbles.java
Areas: if statements.
Download files: BooleanFumbles.java
Areas: if statements.
|
|
BooleanFumbles.java |
|
|
| Question 1 |
| Describe in English what this code is doing. |
| Question 2 |
| Does flag == true change the value of flag? |
| Question 3 |
| What will happen if we mistakenly write if (flag == true); { instead of if (flag == true) { in line 4? |
| Question 4 |
| What would happen if we mistakenly write if (flag = true) rather than if (flag == true) in line 4? |
| Question 5 |
| Write a line of code that is equivalent to Line 4, but simpler. |
| Question 6 |
| Is the code else if (flag == false) necessary? |
| Question 7 |
| Is it necessary to have an if statement in this program excerpt? |
