• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/7

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

7 Cards in this Set

  • Front
  • Back

Generics in Java are like what in C++?

templates

Simple polymorphism - method overloading. Do you have to allocate memory for each overloaded function?

No

How does the simple polymorphism example relate to generics?

Create one method of a generic type --> only have to allocate memory once regardless of the number of times you need to refer to the method with different types. Only works for problems where each method has an equal number of arguments and the only difference is the type of argument

A generic type can be defined for a _____ or ______. A concrete type must be used when using the _____ or _____ to declare a reference variable

A generic type can be defined for a class or interface. A concrete type must be used when using the class or interface to define a reference variable

What is the benefit of using Generic classes rather than Object as the supertype?

Certain errors can be detected at runtime


ArrayList<String> will give an error if anything other than a string is added

How do you create a generic class with more than one parameter?

< E1, E2, E3 >

19.4