Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes SCJP Java 6 Sierra/Bates question on chapter 6 question 8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "SCJP Java 6 Sierra/Bates question on chapter 6 question 8" Watch "SCJP Java 6 Sierra/Bates question on chapter 6 question 8" New topic
Author

SCJP Java 6 Sierra/Bates question on chapter 6 question 8

Scott Hughes
Greenhorn

Joined: Feb 10, 2009
Posts: 2
I am confused about the answer to this question.

The program has a serializable object with a static variable with a value of 9. It writes and object, closes it, and then adds 1 to it so the value is 10. However, when reading the input stream into a new variable, the value is still 10. My assumption was that it was written as 9 and the add occured after the write so the read on the other end would not have the value of 10 (9 was the value stored). However, the result says the answer should be 10.

Can someone please clarify my misunderstanding?

Thanks.
Rafael Angarita
Ranch Hand

Joined: Jan 09, 2009
Posts: 67
I'm not sure, but I think you are talking about this: click here

Cheers,


Rafael Angarita.
SCJP 6.
James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

Static variables are not serialized...

SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
Scott Hughes
Greenhorn

Joined: Feb 10, 2009
Posts: 2
Thanks very much!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SCJP Java 6 Sierra/Bates question on chapter 6 question 8