File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes ClassCastException is occuring. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "ClassCastException is occuring." Watch "ClassCastException is occuring." New topic

ClassCastException is occuring.

Huzefa Zohaib
Ranch Hand

Joined: Nov 21, 2001
Posts: 40
ClassCastException is occuring during execution of the following code.
Please solve this RunTimeError.

I am writing the object to the text file using the following code.
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140

Are you trying to create an User object and serialize it using the above code?
It won't work this way, because what you are actually creating in the above statement is a String object. So you will get a ClassCastException when you try to cast it into an User object.
Try the following code

Quaerendo Invenietis
I agree. Here's the link:
subject: ClassCastException is occuring.
jQuery in Action, 3rd edition