Chapter 5: Booleans and Flow Control
The exercises here are taken from my forthcoming book
The Java Developer's Resource.
Quiz
- Is a float large enough to count the king's wheat?
- Why isn't there a ** or a // operator?
- Given that b is a boolean variable, what's the value of
(b || !b)
?
- Here's one that stumped the author until he got some help from comp.lang.java. What's wrong with this program?
public class BytePrint {
public void main(String[] args) {
for (byte b = -128; b <= 127; b++) {
System.out.println(b);
}
}
}
Exercises
- Write the FahrToCelsius program of the last chapter using a for loop instead of a while loop.
- Write the combination lock programs of Chapter 3 using for loops.
[ Exercises | Cafe Au Lait |
Books |
Trade Shows |
Links | FAQ |
Tutorial |
User Groups ]
Copyright 1996 Elliotte Rusty Harold
elharo@sunsite.unc.edu
Last Modified August 20, 1996