Programming and Problem Solving with Java

(やまだぃちぅ) #1

94


20.What does the expression “sending a message to” mean?
21.Describe the role of a parameter list.
22.What do we call a public class that contains a method called main?
23.What is the function of the readLinemethod of the class BufferedReader?
24.Do we use a returnstatement with a void method?
25.We have used the convention that method names begin with a lowercase letter.
Why does a constructor have to begin with an uppercase letter?

Programming Warm-Up Exercises


1.Write the output statement that prints your name.
2.Write three consecutive output statements that print the following three lines.
The moon
is
blue.
3.Write declaration statements to declare three variables of the class Stringand
two variables of type char. The Stringvariables should be named make,model, and
color. The charvariables should be named plateTypeand classification.
4.Write a series of output statements that display the values in the variables
declared in Exercise 3. Each value should be preceded by an identifying message.
5.Change the PrintNameapplication (pages 71–72) so that it also prints the name in
the following format
First-name Middle-initial. Last-name
Define a new Stringvariable to hold the name in the new format and assign it
the string using the existing variables, any literal strings that are needed for
punctuation and spacing, and concatenation operations. Print the string, labeled
appropriately.
6.Print the following groups of text.
a.Four score
and seven years ago
b.Four score
and seven
years ago
c. Four score
and
seven
years ago
Free download pdf