logo

Crowdly

Browser

Додати до Chrome

Which of the following statements are true? Assume that class WildAnimal...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Which of the following statements are true?

Assume that class WildAnimal { } and its subclass class Tiger extends WildAnimal { } exist.

a) Using List<? extends WildAnimal> is a case of contravariance.

b) Assume the following class List and its use (E is a parameter type):

class List<E> { ... // list of elements of type E

              void add (E elem) {

// add elem to list

...

}

}

List<? super Tiger> animalList = new List<>();

It is possible to add an object of type WildAnimal to the list by calling:

animalList.add(new WildAnimal());

c) Using List<? super Tiger> is a case of covariance.

d) List<?> is compatible to a concrete List of any type.

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.jku.at?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome