View Single Post
  #1 (permalink)  
Old 06-25-2007, 09:30 PM
Ed Ed is offline
Senior Member
 
Join Date: Jun 2007
Posts: 110
Ed is on a distinguished road
ClassCastException
I did an iterator
I have different objects
Some of them are cars, and other trucks (both of them are subclass of Vehicles )
When I iterate in every element of the vector
this error appears:

ClassCastException

this is my code

Code:
while it.hastnext() if (it.next() instanceof truck auxVehicle = (truck)it.next(); if (it.next() instanceof Car auxVehicle = (Auto)it.next();
Reply With Quote
Sponsored Links