Originally posted by Ravi Tripura:
Hi,
I got a "java.lang.ClassCastException" when I try to do the following:
I understood that this Exception is thrown because of the fact that Cast should have been '(String)'.
But can any one tell me if the 'get()' method of Vector returns 'a simple Java Object', why doesn't the compiler allow '(Integer)' that extends a Java Object?
How does the JRE determines the type of Cast allowed ?
thanks in advance,
Ravi.
Hi Ernest,
I have added the following statement to my code:
System.out.println(v.get(0).getClass());
and got the class type information of the object.
thanks very much for the information,
Ravi.