Week 10 Test Review Flashcards
When compiling a class in a package, the javac command-line option _____ specifies where to store the package and causes the compiler to create the package’s directories if they do not exist.
-d
String class static method ______ is similar to method System.out.printf, but returns a formatted String rather than displaying a String in a command window.
format
If a method contains a local variable ______ iwth the same name as one of its class’s fields, the local variable the field in that method’s scope.
shadows
The _____ method is called by the garbage collector just before it reclaims an object’s memory.
finalize
A(n) _____ declaration specifies one class to import.
single - type - import
If a class declares constructors, the compiler will not create a(n) ______.
default constructor
An object’s _______ method is called implicitly when an object appears in code where a String is needed.
toString
Get methods are commonly called ______.
accessor methods, getters, query methods
A(n) _____ method tests whether a condition is true or false.
predicate
For every enum, the compiler generates a static method called _____ that returns an array of the enum’s constants in the order in which they were declared.
values
Composition is sometimes referred to as a(n) _____ relationship.
has-a
A(n) _____ variable represents classwide information that is shared by all the objects of the class.
static
Keyword ______ specifies that a variable is not modifiable.
final
There can be only one _____ in a Java source-code file, and it must precede all other declarations and statements in the file.
package declaration
A(n) _____ declaration imports only the classes that the program uses from a particular package.
type-import-on-demand