This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

basic concepts on Serialization  RSS feed

 
Mark Tigerwood
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16026
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Google!

When you search for "java serialization tutorial" you'll get a whole list of useful links in a fraction of a second.
 
Mark Tigerwood
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!