Self-Review Exercises 8.1 Fill in the blanks in each of the following statements: a) A(n) static import on demand imports all static members of a class. b) String class static method format is similar to method System.out.printf, but returns a formatted String rather than displaying a String in a command window. c) If a method contains a local variable with the same name as one of its class’s fields, the local variable shadows the field in that method’s scope. d) The public methods of a class are also known as the class’s public services or interfaces. e) A(n) single-type-import declaration specifies one class to import. f) If a class declares constructors, the compiler will not create a(n) no-argument constructor. g) An object’s toString method is called implicitly when an object appears in code where a String is needed. h) Get methods are commonly called accessor or query method. i) A(n) predicate method tests whether a condition is true or false. j) For every enum, the compiler generates a static method called values that returns an array of the enum’s constants in the order in which they were declared. k) Composition is sometimes referred to as a(n) has-a relationship. l) A(n) enum declaration contains a comma-separated list of constants. m) A(n) static variable represents classwide information that’s shared by all the objects of the class. n) A(n) single-type-import declaration imports one static member. o) The principle of least privilege states that code should be granted only the amount of privilege and access that it needs to accomplish its designated task. p) Keyword final specifies that a variable is not modifiable after initialization in a declaration or constructor. q) A(n) type-import-on-demand declaration imports only the classes that the program uses from a particular package. r) Set methods are commonly called mutator because they typically change a value. s) Use BigDecimal class to perform precise monetary calculations. t) Use the throw statement to indicate that a problem has occurred. |