Exam 17: Generics

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Which of the following statements is true?

Free
(Multiple Choice)
4.9/5
(37)
Correct Answer:
Verified

B

Let Point< T > be a generic type.We want to write a method that takes as parameter Point objects whose type parameter is the Number class,or any subclass of Number.We can do this by declaring the type of the method parameter as

Free
(Multiple Choice)
4.9/5
(34)
Correct Answer:
Verified

C

The code fragment Class MySArrayList extends ArrayList< String > { }

Free
(Multiple Choice)
5.0/5
(29)
Correct Answer:
Verified

A

A generic class

(Multiple Choice)
4.7/5
(34)

The process of erasure

(Multiple Choice)
4.8/5
(38)

Erasure is the process of

(Multiple Choice)
4.9/5
(42)

The process used by the Java compiler to remove generic notation and substitute actual type arguments for formal type parameters is called

(Multiple Choice)
4.8/5
(44)

Exceptions of a generic type

(Multiple Choice)
4.8/5
(37)

Suppose that Point< T > is a generic type,and that we have a method of the form Void printPoint(Point< ? > p){ // Code not shown }

(Multiple Choice)
4.8/5
(41)

Look at the following method header: Void displayPoint(Point< ? super Double > myPoint)Which of the following objects can be passed as an argument to the displayPoint method?

(Multiple Choice)
4.8/5
(35)

Let Point< T > be a generic type.We want to write a method that takes as parameter Point objects whose type parameter is the Number class,or any superclass of Number.We can do this by writing

(Multiple Choice)
4.9/5
(37)

An advantage of using generic types is

(Multiple Choice)
4.8/5
(31)

When a generic class with an unconstrained type parameter is instantiated without specifying an actual type argument,

(Multiple Choice)
4.7/5
(32)

When you create an instance of a generic class,what types can you pass as arguments for the class type parameters?

(Multiple Choice)
4.9/5
(32)

The class Public class Point3D< T extends Number > extends Point< T > { } Is an example of

(Multiple Choice)
4.9/5
(36)

The notation < E implements Comparable< E > >

(Multiple Choice)
4.9/5
(44)

The declaration Class Point< T extends Number > { } Is an example of

(Multiple Choice)
4.9/5
(37)

A static method of a generic class

(Multiple Choice)
4.9/5
(45)

When a generic class is instantiated without specifying an actual type argument,the generic class is being used

(Multiple Choice)
4.9/5
(37)

A class is generic

(Multiple Choice)
4.7/5
(34)
Showing 1 - 20 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)