Lecture 20 Objectives
At the end of today's class you should
KNOW:
- That every class has Object as a superclass
- That Java generics allow you to create classes that are parameterized
over data types
- That generics provide more refined type checking than using Object
as a data type for abstraction
BE ABLE TO:
- Use Object to abstract over a data type
- Use Java generics to abstract over a data type
Sample Exam Question:
We looked at two ways to abstract over the datatype, using Object as the
datatype, and using generics to specify the datatype. What is the advantage
of using generics over using Object?