aspose file tools
The moose likes Beginning Java and the fly likes basic concepts on Serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "basic concepts on Serialization" Watch "basic concepts on Serialization" New topic
Author

basic concepts on Serialization

Mark Tigerwood
Greenhorn

Joined: Nov 04, 2006
Posts: 11
Hi all,

I would like to know some basic concepts on Serialization, Transient and Volatile? Any good java tutoiral explaining this with some good examples?
Ankur Sharma
Ranch Hand

Joined: Dec 27, 2005
Posts: 1234
Originally posted by Mark Tigerwood:
Hi all,

I would like to know some basic concepts on Serialization, Transient and Volatile? Any good java tutoiral explaining this with some good examples?


Dear Mark,

You must check this out....

You will definately find so much of you needed..

1. Most Important

another one is
Transient Variables

Hope it helps you out..


The Best way to predict your future is to create it
Ankur Sharma
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

Use Google!

When you search for "java serialization tutorial" you'll get a whole list of useful links in a fraction of a second.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Mark Tigerwood
Greenhorn

Joined: Nov 04, 2006
Posts: 11
Me too know there is a google engine which will bring us what we needed in a fraction of seconds. Why I am posting is, since this gorup members will know some good tutoirals(with samples/examples) for beginners than the google which will list from advanced. May be a silly question to post, but the below thing managed to post me..


Any way, thanks for your help. And here goes my second question on serializing/deserializing.

I am first serializied the object state in the file called "hi.ser", then when I tried to desrialized I am getting this error:




import java.io.*;

public class BoxRecover{
public static void main(String args[]){

Box myBox = new Box();
try{
FileInputStream fi = new FileInputStream("Hi.ser");
ObjectInputStream oi = new ObjectInputStream(fi);
Box width1 = (Box) oi.readObject();
System.out.println("width ::::::::"+myBox.getWidth());

}catch(Exception e){
e.printStackTrace();
}
}
}
sven studde
Ranch Hand

Joined: Sep 26, 2006
Posts: 148
An InvalidClassException will be thrown when you change something in your Box class after writing to the file. I have no problems with the files you posted: I can compile and run them and get the expected output.

By the way, for testing purposes you can organize your classes like this:


[ November 11, 2006: Message edited by: sven studde ]
[ November 11, 2006: Message edited by: sven studde ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: basic concepts on Serialization
 
Similar Threads
live examples of serialization ?
About SCWCD Exam Study Kit 2nd ed.
is serialization removed from syllabus?
Beginner in Java(suggest some books plzzz)
OOP Concepts