Java Reference
In-Depth Information
i. language = "English";
if (country.equals("US"))
if (state.equals("PR")) language =
"Spanish";
else if (country.equals("China"))
language = "Chinese";
217
218
΢
Exercise R5.2. Explain the following terms, and give an example for each
construct:
a.
Expression
b.
Condition
c.
Statement
d.
Simple statement
e.
Compound statement
f.
Block
΢
Exercise R5.3. Explain the difference between an if/else if/else
statement and nested if statements. Give an example for each.
΢
Exercise R5.4. Give an example for an if/else if/else statement
where the order of the tests does not matter. Give an example where the
order of the tests matters.
΢
Exercise R5.5. Of the following pairs of strings, which comes first in
lexicographic order?
a. "Tom", "Dick"
b. "Tom", "Tomato"
c. "church", "Churchill"
d. "car manufacturer", "carburetor"
Search WWH ::




Custom Search