Originally posted by Ravi Nistala:
I also thought that i can return an "ArrayList " of either numbers,or integers and also as Wong mentioned above. But in the K&B book (the last question in collections) , it is said that you cannot return "ArrayList". It has to be "List".That is what i cannot understand.Am i missing something?
From the definition, it is indeed expecting that a List be returned. However, since an ArrayList implements the List interface, an ArrayList *is* an instance of a List -- and hence, an ArrayList may be returned as the List.
Henry