Beruflich Dokumente
Kultur Dokumente
Name:
Exercises 23.1
Date:
Period:
1.
2.
3.
4.
5.
6.
Rounded to the nearest billion, what is the maximum integer an int can store?
7.
8.
9.
Look again at program Java2301.java. Why does the 1st line below display 253 and the 2nd display 28?
System.out.println("25 + 3 = " + 25 + 3);
System.out.println("25 + 3 = " + (25 + 3));
10.
11.
12.
13.
14.
15.
16.
17.
Assume x and y are char variables. Print the code that will assign both the value of J in one statement.
18.
Assume x is an int variable. You want to add 1 to x with the least amount of code possible. How do you do it?
6/16/2007
19.
Assume x is an int variable. You want to subtract 2 from x with the least amount of code possible. How do you do it?
20.
Assume x is an int variable. You want to triple the amount in x with the least amount of code possible. How do you do
it?
21.
Assume x is an double variable. You want to chop the value in x in half with the least amount of code possible.
How do you do it?
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
35.
Refer to the previous question. What is the purpose of the p <= 15; ?
36.
6/16/2007