Page 500 - Introduction to Programming with Java: A Problem Solving Approach
P. 500

                466
Chapter 11 Type Details and Alternate Coding Mechanisms
int x = 1;
while (x < 4);
{
}
System.out.println(x);
x++;
§11.11 break Statement within a Loop
17. Usually, you should avoid using break except in switch statements because using break statements
forces readers to look for termination conditions inside loop bodies. (T / F)
§11.12 for Loop Header Details
18. Assume that the following code fragment is inside of a program that compiles successfully. What does the
code fragment print?
for (int i=0,j=0; ; i++,j++)
{
}
System.out.print(i + j + " ");
§11.13 GUI Track: Unicode (Optional)
19. What is the hexadecimal symbol for the decimal number 13?
20. The Unicode values for characters are the same as the ASCII values in the range 0x00 to 0xFF. (T / F)
Exercises
Apago PDF Enhancer
 1. [after §11.2] If an integer overflows, what type of error is produced—compile-time error, runtime error, or logic error?
2. [after §11.4] How many bits are used to store a char value?
3. [after §11.4] What does this print? System.out.println('A' + 2);
4. [after §11.6] Assume a and b are boolean variables. What are their values after this statement executes?
a =!((b=4<=5) && (a=4>=5));
Hint: First rewrite the statement to make it more readable.
5. [after §11.7] Assume this:
int a = 2;
float x = 8.0f;
boolean flag = true;
Evaluate:
(flag) ? (a = (int) (x + .6)) : a
6. [after §11.8] Assume this: int a = 10;
int b = 2;
double x = 6.0;
Evaluate each of the following expressions. Follow these guidelines:




























































   498   499   500   501   502