Saral Saxena wrote:Now could you guys please show me through a small program demo,,!!
Saral, if you are serious about learning to program in Java, you will need to take initiative yourself, instead of constantly asking other people to write examples for you.
The best way to learn programming is to experiment yourself. Write code yourself, if it doesn't work, carefully try to understand what the error messages mean, change your program and try again, until it works.
It's also much more fun when you do that - the satisfaction of solving a problem you have been working on for a while is nice.
Now, about this question. You know already exactly what has to be done, because you wrote this yourself:
Saral Saxena wrote:To avoid java serialization you need to implement writeObject () and readObject () method in your Class and need to throw NotSerializableException from those method.
It's very easy to make a short program with exactly this. The API documentation of the interface java.io.Serializable (<= link, click on it) tells you exactly what the writeObject() and readObject() methods should look like.
Try it yourself, and post your results, then we'll tell you if you did it correctly.