A: 

Can you post the rest of the text of your exception?

It could be that you are reading and writing slightly different versions, but without the full exception it is a bit hard to help much further.

Simon
A: 
wellenreiter
Umm, that's not an exception, that's a code fragment.
skaffman
We need the actual exception and getStoredMails method to help
Kristian
Exception in thread "main" java.lang.ClassCastException: sotring.Message at sotring.storeing.getStoredMails(storeing.java:49) at sotring.storeing.main(storeing.java:87)
wellenreiter
line 87: getStoredMails(restored);line 49: array = (Message[]) in.readObject(); // i think this is wrong
wellenreiter
If you think that's wrong, do an output of in.readObject().getClass() to see what class it is. You can also debug it to see.
MetroidFan2002
I tried to return in.readObject().getClass() and i tried also in.readObject().getClass().toString() but it dont worked. Sry i just startet with this topic :-( I get: Error: Unresolved compilation problem: This method must return a result of type String. Isnt the return string?
wellenreiter
+1  A: 

I got it! the misstake was in the other class, that isn listed, im sorry. But one last question about this. If I safe an Array and reload it, is there a possibility to get the size if its unknown? Thanks

wellenreiter