Java Reference
In-Depth Information
d. When a return statement executes in a user-defined method, the
method immediately exits.
e. A value-returning method returns only integer values.
f. If a Java method does not use parameters, parentheses around the empty
parameter list are still needed.
g. In Java, the names of the corresponding formal and actual parameters
must be the same.
h. In Java, method definitions can be nested; that is, the definition of one
method can be enclosed in the body of another method.
2. Determine the value of each of the following expressions:
a. Character.toUpperCase('b')
b. Character.toUpperCase('7')
c. Character.toUpperCase('K')
d. Character.toUpperCase('*')
e. Character.toLowerCase('D')
f. Character.toLowerCase('8')
g. Character.toLowerCase('h')
h. Character.toLowerCase('$')
3. Determine the value of each of the following expressions. (Format your
answer with two decimal places.)
a. Math . abs(-4)
b. Math . abs(10.8)
c. Math . abs(-2.5)
d. Math . pow(3.2, 2)
e. Math . pow(2.5, 3)
f. Math . sqrt(25.0)
g. Math . sqrt(6.25)
h. Math . pow(3.0, 4.0) / Math . abs(-9)
i. Math . floor(28.95)
j. Math . ceil(35.2)
4. Using the methods described in Table 7-1, write each of the following as a
Java expression:
2.0 5.2
a.
p
x þ y
b.
u v-3
c.
b 2 4 ac
p
2 a
d.
x þ 2 : 5
j
j
e.
Search WWH ::




Custom Search