When should we go for Serialization in a Java project? please give some example.Is it possible to serialize static variables? if yes then how & if no then why? please explain it...
Serialization should be used with caution. If your class changes frequently, you will get into serious trouble reading old serialized files. So, in general an xml format or a database is the better choice.
Note that "serialization" is a process, and it can be implemented in different ways. Out of the box, Java offers binary serialization (via the Object[In|Out]putStream classes) and XML serialization for JavaBean objects (via the XML[De|En]coder classes). As Sebastian mentioned, the binary format is brittle in the face of class changes, and may break when used between different JVM versions; so the XML format is a better choice these days (and is amenable to changes by non-JVM processes, which may or may not be useful in your circumstances).