|
|
|
|
135
|
* Modify the `getArray` method signature by declaring it `abstract` of return type `E`.
|
135
|
* Modify the `getArray` method signature by declaring it `abstract` of return type `E`.
|
136
|
* An abstract method is a subclass's contractual agreement to the deferment of an implementation of a respective method.
|
136
|
* An abstract method is a subclass's contractual agreement to the deferment of an implementation of a respective method.
|
137
|
* You may need to create an [inner class](https://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html) to test make the People class
|
137
|
* You may need to create an [inner class](https://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html) to test make the People class
|
|
|
138
|
+
|
138
|
-
|
139
|
-
|
139
|
### Part 10.2 - Modify `People` subclasses
|
140
|
### Part 10.2 - Modify `People` subclasses
|
140
|
* Modify the `Students` class signature to ensure that it is a subclass of `People` of parameterized type `Student`.
|
141
|
* Modify the `Students` class signature to ensure that it is a subclass of `People` of parameterized type `Student`.
|
141
|
* Modify the `Instructors` class signature to ensure that it is a subclass of `People` of parameterized type `Instructor`.
|
142
|
* Modify the `Instructors` class signature to ensure that it is a subclass of `People` of parameterized type `Instructor`.
|
142
|
* See if you can modify the `getArray` method in the `People` class to return the generic array back. Otherwise, add concrete implementations of the `getArray` method in each of these classes
|
143
|
* See if you can modify the `getArray` method in the `People` class to return the generic array back. Otherwise, add concrete implementations of the `getArray` method in each of these classes
|
143
|
- * HINT: To create a new generic array, you can use `E[] array = (E[]) Array.newInstance(Student[].class.getComponentType(), list.size());`. Note in this code, when I call newInstance, I give the Student[].class. Change it so it can be Student[] or Instructor[] or Person[].
|
|
|
|
|
144
|
+ * HINT: To create a new generic array, you can use `E[] array = (E[]) Array.newInstance(Student[].class.getComponentType(), list.size());`. Note in this code, when I call newInstance, I give the Student[].class. Change it so it can be Student[] or Instructor[] or Person[].
|
|
|
145
|
+
|
144
|
-
|
146
|
-
|
145
|
### Part 10.3 - Refactor `ZipCodeWilmington` class
|
147
|
### Part 10.3 - Refactor `ZipCodeWilmington` class
|
146
|
* Refactor the `hostLecture` method in the `ZipCodeWilmington` class by removing any intermediate _casting trick(s)_.
|
148
|
* Refactor the `hostLecture` method in the `ZipCodeWilmington` class by removing any intermediate _casting trick(s)_.
|