Originally posted by Abhishek Reddy Chepyala:
here is my doubt I declared 'q' is of type Queue which is generic type and can hold only String values, whereas in showAll() wch takes queue as parameter, iam trying to enter interger objects into the queue. Is it possible if yes explain me..
Yes, this works, since the Generic code can be freely mixed with corresponding non-generic code. Howeverif you try to treat the Integer as a String later on [assuming that you passed a Queue<String> ;] , you would get a ClassCastException.
[ August 07, 2006: Message edited by: Neelesh Bodas ]