So I have the following code:
My question is why am I allowed to put a
String object in the Queue helped, in the method helpPeople, when the Queue given to the method as argument. helpedQ, is a Queue<Person>? I understand why the compiler allows this (it only gives a warning), but shouldn't the code throw an ClassCastException or any other exception? Because in the end I will have a Queue of Person objects, with a String object in it.
Thanks in advance!