4.1 Fill in the blanks in each of the following:
The format specifier is used to display values in a monetary format.
Every class declaration contains keyword followed immediately by the class’s name.
Operator creates an object of the class specified to the right of the keyword.
Each parameter must specify both a(n) and a(n) .
Return type indicates that a method will not return any information when it completes its task.
When each object of a class maintains its own copy of an attribute, the attribute is known as a(n) .
For a(n) , the compiler automatically generates a private
instance variable and set
and get
accessors.
Variables of type are typically used to represent monetary amounts.
decimal
method converts a string
to a decimal
value.
Keyword public
is a(n) .
4.2 State whether each of the following is true or false. If false, explain why.
By convention, method names begin with a lowercase first letter and all subsequent words in the name begin with a capital first letter.
A property’s get
accessor enables a client to modify the value of the instance variable associated with the property.
All instance variables are initialized by default to null
.
Empty parentheses following a method name in a method declaration indicate that the method does not require any parameters to perform its task.
The number of arguments in the method call must match the number of required parameters in the method declaration’s parameter list.
Variables or methods declared with access modifier private
are accessible only to members of the class in which they’re declared.
Variables declared in the body of a particular method are known as instance variables and can be used in all methods of the class.
A property declaration must contain both a get
accessor and a set
accessor.
The body of any method or property is delimited by left and right braces.
Local variables are initialized by default.
4.3 What is the difference between a local variable and an instance variable?
4.4 Explain the purpose of a method parameter. What is the difference between a parameter and an argument?