Get your CodeRanch badge!*
The moose likes Distributed Java and the fly likes What the hell is a serialized object? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "What the hell is a serialized object?" Watch "What the hell is a serialized object?" New topic
Author

What the hell is a serialized object?

Frank Wu
Greenhorn

Joined: Jan 14, 2002
Posts: 25
From my understanding,
1. A String, An Integer etc are serialized objects.
2. A class implements Serializable interface is an serialized object.
3. How about this: Is "A" a serialized class?
Class A {
String a;
SerializedClass B;
};

4. In java, when using a serialized object as a parameter, is it always pass by value?
The answer should be NO. Right?
Anybody can clear these for me?
Thanks,
John
Rajeev Gupta
Greenhorn

Joined: Nov 28, 2001
Posts: 16
Hi Frank Wu
1-U should check the Java API. If Integer class has implemented a Serializable then it is serializable otherwise not.
2- A class which implements a Serializable interface produces serailizable object.
3- No this class is not Serializable
to make it serializable u should define it like this...
Class A implements Serializable
{
String a;
SerializedClass B;
}
4. In java, when using a serialized object as a parameter, is it always pass by value? ;
The answer to this question is YES!!!
But when u pass an object which has implemented Remote interface it is call by reference.
Bye
Raajeev
Frank Wu
Greenhorn

Joined: Jan 14, 2002
Posts: 25
See the below program
java.util.Vector implements Serializable, but is not pass by value!
/*
javap java.util.Vector;
public class java.util.Vector extends java.util.AbstractList implements java.util.List, java.lang.Cloneable, java.io.Serializable {
*/
public class jTest {
public static void change (Vector vec) {
vec.add("abc");
};

public static void main(String args[]) {
Vector v = new Vector();
System.out.println("len:" + v.size());
change(v);
System.out.println("len:" + v.size());
}
};

secadm@porpoise:/export/home/secadm/security> java jTest
len:0
len:1
Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
So value or not???


Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What the hell is a serialized object?
 
Similar Threads
What serialized object looks like?
Object serialization
Bean serialisation
Serialization
static and serialization