aspose file tools
The moose likes Java in General and the fly likes Instance of JVM and Serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Instance of JVM and Serialization" Watch "Instance of JVM and Serialization" New topic
Author

Instance of JVM and Serialization

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 201

Hi all,
I am confused about the term "instance of jvm" referring to this statement in K&B.

"Clearly in Java it wouldn't make any sense to
save the actual value of a reference variable, because the value of a Java reference has
meaning only within the context of a single instance of a JVM."

Please make this statement clear.What does instance of JVM mean?

thanks....
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

http://javabeanz.wordpress.com/2007/07/09/understanding-jvm/
http://www.artima.com/insidejvm/ed2/jvm.html

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32708
    
    4
It means the actual JVM you have running at the moment. If you write java Foo or similar, you start a new instance of the JVM. The memory location of each object is different for different JVM instances.
Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 201

Yes,I do agree.But when i created a class and its object,and tried to print the value of the reference variable,each and every time i got the same value for the reference variable.So,if the memory location of objact changes each time with new instances of jvm,how come the reference varaibles value is the same?
Does reference variable's value has anything to do with object's memory location?

Please reply...
Ahmad Yazdankhah
Greenhorn

Joined: Jul 30, 2011
Posts: 8

To clarify your question, can you provide a piece of code?
Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 201

Hey Ahmed,
thanks for having a look at the question.
Actually,I found out that,no,the value of reference variable and the value of object's memory address(obj.hashCode()) changes or may change with individual JVM instances.
Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 201

Hi all,
One more thing to ask,does the object reference signifies in any way the object's memory location?
I guess it does,though i am not sure.

Please guide me through.

Thanks...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Instance of JVM and Serialization
 
Similar Threads
jiris mock question
Is Constructor is invoked during object creation
I am not getting K&B page 445
Instance of JVM?
serialization: object casting doubt