View Single Post
  #2 (permalink)  
Old 01-31-2008, 04:12 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Same instances
Hello bugger.

arrayList1 and arrayList2 are both instances of ArrayList, but they are of different type. arrayList1 can contain a Collection object. Although arrayList1 is actually an ArrayList, the compiler will see it as an object of type Collection. To use arrayList1 as an ArrayList you must first cast it. arrayList2 is an object of type ArrayList and no cast is necessary. But, in essence they are both still ArrayList objects.

Does that help?
__________________
If your ship has not come in yet then build a lighthouse.
Reply With Quote