Deserializing objects sent from a client program to a server program

I’ve tried that and now it gives me this error:
Illegal modifier for the class ImagenSerializable; only public, abstract & final are permitted

I can’t make a top-level static class, but to implement the Serializable interface I need the class to be static I don’t know how to either make it non-static or non-top-level

Thank you