> I have an Iterator that I need to cast to a
> ListIterator and when I do this I get a
> ClassCastException. Can someone tell me why? Thanks.
The VM can do the job of telling you why quite nicely. Debug it.
Iterator it = ...
System.out.println("This Iterator is really a " + it.getClass());
> object casting--we can cast a sub class to a super
> per class ,but u cant cast a super class to a sub
> class,in util the iterator is the super class and the
> listiterator is the sub class.so u cant cast iterator
> to listiterator
I guess I need some kind of a tutorial to understand your English without going crazy.