E20 - M

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Generics provide __________ that allows programmers to catch invalid types at compile time. a. compile-time type safety. b. compile-time exception handling. c. compile-time error checking. d. run-time type safety.

a

When compiling a generic class, the __________ option should be used to view the unchecked warning message. a. -Xlint:unchecked. b. -X:unchecked. c. -warning:unchecked. d. -unchecked.

a

When the compiler translates a generic method into Java bytecodes, it uses __________ to replace the type parameters with actual types. a. erasure. b. compile-time type replacement. c. compile-time type checking. d. compile-time type safety.

a

A wildcard type argument is denoted by a(n) __________. a. asterisk (*). b. underscore (_). c. question mark (?). d. caret (^).

c

Which of the following statements is false? a. Wildcard type arguments enable you to specify method parameters, return values, variables, and so on, that act as supertypes of parameterized types. b. A wildcard-type argument is denoted by ?, which represents an "unknown type." c. Because a wildcard is a type-parameter name, you can use it as a type name throughout a method's body. d. If a wildcard is specified without an upper bound, then only the methods of type Object can be invoked on values of the wildcard type.

c

Which of the following statements is true? a. Overloaded methods are often used to perform similar operations on different types of data. b. When the compiler encounters a method call, it attempts to locate a method declaration with a name and parameters that are compatible with the argument types in the method call. c. Both a) and b) are true. d. Neither a) nor b) is true.

c

Which statement is false? a. A generic method may be overloaded. b. A class can provide two or more generic methods that specify the same method name but different method parameters. c. A generic method cannot be overloaded by non-generic methods. d. When the compiler encounters a method call, it searches for the method declaration that most precisely matches the method name and the argument types specified in the call.

c

__________ enable programmers to specify, with a single method declaration, a set of related methods. a. Overloaded methods. b. Overriden methods. c. Generic methods. d. Generics.

c

Class Number is ________ of both Integer and Double. a. the subclass b. composed c. a descendent d. the superclass

d

One generic Stack class could be the basis for creating many Stack classes, e.g., Stack<Double>, Stack<Integer> and Stack<Employee>. These classes are known as __________. a. subclasses. b. generic subclasses. c. concrete classes. d. parameterized classes.

d

__________ is the default upper bound of a type parameter. a. String. b. Comparable. c. Class. d. Object.

d

All generic method declarations have a type parameter section delimited by __________. a. curly brackets ({ and }). b. angle brackets (< and >). c. square brackets ([ and ] ). d. parenthesis.

b

Which statement is false? a. When declaring a generic method, the type parameter section is placed before the return type of the method. b. Each type parameter section contains only one type parameter. c. A type parameter is an identifier that specifies a generic type name. d. Type parameters can represent only reference types.

b


Set pelajaran terkait

Imagery and Figurative Language in Tennyson's "Morte d'Arthur"; Quiz

View Set

Environmental Health Final True / False

View Set

Animal Phys: Respiratory Pigments and Gas Exchange

View Set

306 Ricci PrepU Chapter 22: Nursing Management of the Postpartum Woman at Risk

View Set