CMSC 132 Exam 2 Review Quiz

BullishLarimar avatar
BullishLarimar
·
·
Download

Start Quiz

Study Flashcards

5 Questions

What is a subtype of Object[]?

String[]

What does the notation 'public MyClass' indicate?

Usage of a generic type inside the class

What can be used to avoid an ArrayStoreException?

Using an ArrayList instead of an array

Which type of list is a subtype of ArrayList?

LinkedList

What does the wildcard notation 'ArrayList<? extends Chicken>' represent?

Any type that extends Chicken

Study Notes

Subtypes of Arrays

  • Object[] is a supertype, and its subtypes can be arrays of specific classes or interfaces.

Class Access Modifiers

  • The notation 'public MyClass' indicates that the class MyClass has public access, meaning it can be accessed from anywhere.

Avoiding ArrayStoreException

  • Using generics or parameterized types can be used to avoid an ArrayStoreException, which is thrown when trying to store the wrong type of object into an array of objects.

Subtypes of ArrayList

  • LinkedList is a subtype of ArrayList, which means it inherits the properties and methods of ArrayList.

Wildcard Notation in Generics

  • The wildcard notation 'ArrayList<? extends Chicken>' represents a list that can hold any type of object that is a subclass of Chicken, but not a superclass of Chicken.

Prepare for your CMSC 132 Exam 2 with this review notes quiz by Andy Yu. Topics include parameterized types, deadlock, Big-O notation, and subtype relationships. Get 6 free points with an announcement. Sharpen your understanding of generic notation and interface extension for a comprehensive exam overview.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser