Final exam _ programming
A constructor is a method that is automatically called when an object is created.
True
A method that stores a value in a class's field or in some other way changes the value of a field is known as a mutator method.
True
Shadowing is the term used to describe where the field name is hidden by the name of a local or parameter variable.
True
The key word this is the name of a reference variable that an object can use to refer to itself.
True
To determine if two arrays are equal you must compare each of the elements of the two arrays.
True
enum constants have a toString method.
True
A static field is created by placing the key word static ________.
after the access specifier and before the field's data type
The following statement is an example of ________. import java.util.Scanner;
an explicit import statement
The ________ indicates the number of elements the array can hold.
array's data type
Java automatically stores a ________ value in all uninitialized static member variables.
0
A method that gets a value from a class's field but does not change it is known as a mutator method.
False
A class that is defined inside another class is called a(n) ________.
Inner class
Another term for an object of a class is a(n) ________.
Instance
A constructor ________.
has the same name as the class
In Java, you do not use the new operator when you use a(n) ________.
initialization list
Each array in Java has a public field named ________ that contains the number of elements in the array.
length
If you have defined a class, SavingsAccount, with a public static data member named numberOfAccounts, and created a SavingsAccount object referenced by the variable account20, which of the following will assign numberOfAccounts to numAccounts?
numAccounts = SavingsAccount.numberOfAccounts;
Static methods can only operate on ________ fields.
static
Which of the following is not involved in identifying the classes to be used when developing an object-oriented application?
the code
When a reference variable is passed as an argument to a method ________.
the method has access to the object that the variable references
If you attempt to perform an operation with a null reference variable ________.
the program will terminate
To indicate the data type of a variable in a UML diagram, you enter ________.
the variable name followed by a colon and the data type
The ________ method is used to insert an item into an ArrayList.
to add
The sequential search algorithm ________.
uses a loop to sequentially step through an array, starting with the first element
If you have defined a class, SavingsAccount, with a public static method, getNumberOfAccounts, and created a SavingsAccount object referenced by the variable account20, which of the following will call the getNumberOfAccounts method?
SavingsAccount.getNumberOfAccounts();