Page 1 of 1
About Question enthuware.ocpjp.v7.2.1305 :
Posted: Wed Mar 12, 2014 11:15 am
by tn1408
Could this method: public boolean add(Object o) be overloading the method: public boolean add(E e) of the ArrayList class?
Re: About Question enthuware.ocpjp.v7.2.1305 :
Posted: Wed Mar 12, 2014 9:13 pm
by admin
What happened when you tried it out ?
-Paul.
Re: About Question enthuware.ocpjp.v7.2.1305 :
Posted: Wed Apr 23, 2014 12:57 pm
by dhunziker
The actual compiler error is probably quite helpful here:
Code: Select all
Name clash: The method add(Object) of type BookList has the same erasure as add(E) of type ArrayList<E> but does not override it
You can still override the method using Book or overload it by using a type other than Object.
Re: About Question enthuware.ocpjp.v7.2.1305 :
Posted: Fri May 02, 2014 12:15 pm
by ewebxml
The explanation for option d) should say:
"Observe that BookList extends a typed ArrayList" instead of
"Observer that BookList extends a typed ArrayList".
Please confirm.
Re: About Question enthuware.ocpjp.v7.2.1305 :
Posted: Fri May 02, 2014 7:50 pm
by admin
Fixed.
Thank you for your feedback!