ClassCastException()
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   GIRISH_LIMAYE
Posted On:   Thursday, December 4, 2008 01:40 AM

I have 2 classes serialized. In one class i serialize the object and write it to .txt file and in another class i read out the same object from that .txt file typecasting it to 1st class. When i make attempt to read the object I get ClassCastException(). Both the classes are in same package.
Can anyone help me out on this matter.
Thnx in advance.

Re: ClassCastException()

Posted By:   Mohammad_Abdo  
Posted On:   Thursday, December 4, 2008 05:58 AM

Dear,

Read the Object from the file, and before casting it to your Custom Class use:

System.out.println(object.getClass().getName());

To know your real object type.

I hope this will help..

Thanks
About | Sitemap | Contact