• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Serialization

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all..
Am studying serialization from the Sierra-Bates SCJP book..Here it says that when we try to serialize/deserialize a transient class variable by writing our own writeObject/readObject method
the return type of the readObject method is void.It goes like-
private void readObject(ObjectInputSteam is)
But isnt the method supposed to return an Object??
Else how do we get the deserialized object?
Thanks in advance..
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Serialization is not on the exam, so you can relax.
2. Also the readObject method is supposed to set properties of the class in which its implemented i.e. the this reference...
 
Ranch Hand
Posts: 62
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Serialization is not in the exam ?? can someone confirm this ? i just practiced the serialization part today :/
 
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Torsten Oppermann wrote:Serialization is not in the exam ?? can someone confirm this ? i just practiced the serialization part today :/



Ikpefua wrote:


Hello Torsten, It is true that Serialization has been removed from the exams, here is the link:

https://coderanch.com/t/527879/java-programmer-SCJP/certification/Deal-Changing-Objectives

Be informed that NOT all exam centers have been updated, I advise you to go ahead and study it.
 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua Jacob-Obinyan wrote:Be informed that NOT all exam centers have been updated, I advise you to go ahead and study it.


Serialization was removed from the exam more than a year ago. Its highly unlikely that you'll face any serialization questions on the exam, but again as Ikpefua said, there is not hard in gaining some knowledge. Be sure to focus more on other topics which are part of the exam...
 
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua Jacob-Obinyan wrote:
Be informed that NOT all exam centers have been updated, I advise you to go ahead and study it.



I believe that the exam is downloaded from the Oracle's website, just before you are ready to start with your exam. If this is the case, then how is it possible that some centres may not have been updated?? Is it possible that some centres download and store the exam and reuse it over a period of time??

Mala
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mala Gupta wrote:

Ikpefua Jacob-Obinyan wrote:
Be informed that NOT all exam centers have been updated, I advise you to go ahead and study it.



I believe that the exam is downloaded from the Oracle's website, just before you are ready to start with your exam. If this is the case

Mala


Ikpefua wrote:


@Mala I am afraid I am NOT in any position to answer questions based on your 'believe' and your 'if'. Please click on the following link and READ carefully.

https://coderanch.com/t/527879/java-programmer-SCJP/certification/Deal-Changing-Objectives

NOTE: That I am NOT trying to be arrogant, I am simply trying to make you understand the difference between 'what-we-believe' AND 'reality'.
 
Mala Gupta
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua Jacob-Obinyan wrote:
@Mala I am afraid I am NOT in any position to answer questions based on your 'believe' and your 'if'. Please click on the following link and READ carefully.



I would refrain from posting a statement, if I am not sure about it.

Anyway, Thanks for the link.

Mala
 
Mohit Daga
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If they do give the old format in certain places,then they might also stick to the old 72 question format.right?i am due to give the exam on the 23rd.
 
Mala Gupta
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mohit,

I would strongly recommend you to call up the center where you have scheduled your exam and talk about your concerns with the best person. I would also recommend that you ask them how can you be sure that you get the questions as per the latest exam objectives, especially when people on forums like this are claiming to have written an exam on an earlier version.

Additionally, it is always helpful if you are well informed about the exam details. Note down the total exam questions and passing score from Oracle's website and talk to them (your exam center) about these numbers.

Post your experience here. It will help others.

cheers
Mala
 
Mohit Daga
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot,Mala.Will surely post about the exam.I just hope I am able to pass!
 
Mala Gupta
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mohit,

Please share your experience of querying the exam center about how do they ensure that candidates get to attempt the SCJP/ OCPJP exam on the latest exam version.

I wish you Good Luck.

cheers
Mala
 
Mala Gupta
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ikpefua,

No need for guess work, anymore. This query (questions on exam objectives that have been removed from the latest SCJP/ OCPJP) exam has been answered by Gary Fluitt, Senior Manager, Oracle Certification Program, Oracle, in the following thread:

https://coderanch.com/t/527879/java-programmer-SCJP/certification/Deal-Changing-Objectives

cheers
Mala
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mala,
Thanks for passing on this information. As you said there's NO need for guess work anymore!.
In general I will advise that if you have time to study serialization, wait(), notify() etc go ahead, there's NO harm in adquiring more knowledge, in fact this helps you better equiped for your first job!.

Cheers!.
Ikpefua.
 
Mohit Daga
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mala,
The exam centre people I called were not very helpful regarding the matter.They tell me that they have recently received a mail from Oracle which says that a new format for the exam is to be implemented in "short time".This,new format he says has not been implemented before.Any idea about this?According to the person it might just be implemented anytime since the date was not specifically mentioned.Also,the person tells me that the exam is downloaded from Oracle at the time one is giving the exam.And not stored in the centre as some were saying.Puts me in a pickle, this situation!
Hope this helped.
Mohit
 
Mala Gupta
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua Jacob-Obinyan wrote:Mala,
In general I will advise that if you have time to study serialization, wait(), notify() etc go ahead, there's NO harm in adquiring more knowledge, in fact this helps you better equiped for your first job!.

Cheers!.
Ikpefua.



Thanks, Ikpefua. I have already earned my SCJP certification and used these with real life projects! :-)

cheers
Mala
 
Mala Gupta
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohit Daga wrote:Mala,
The exam centre people I called were not very helpful regarding the matter.They tell me that they have recently received a mail from Oracle which says that a new format for the exam is to be implemented in "short time".This,new format he says has not been implemented before.Any idea about this?According to the person it might just be implemented anytime since the date was not specifically mentioned.Also,the person tells me that the exam is downloaded from Oracle at the time one is giving the exam.And not stored in the centre as some were saying.Puts me in a pickle, this situation!
Hope this helped.
Mohit



Mohit,

I am afraid I am not aware of/ don't have any info on the change in the exam format.

I would recommend that you inquire with the exam center regarding the changes in the format of the exam - change in the number of questions/ duration/ passing score/ any other? If they don't know abt the change/ aren't willing to share the details, you can contact Oracle directly yourself. Try the following link:

http://www.oracle.com/us/support/contact-068555.html#asia

You can also email folks at Oracle/ post a question at a relevant thread at blogs.oracle.com. The folks there are pretty good and you should receive a reply very soon.

cheers
Mala
 
Mohit Daga
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you,Mala for being so awfully helpful!yet to confirm with the Oracle guys,how its going to be.
 
Ranch Hand
Posts: 125
Postgres Database BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know that Serialization is not in the exam, but i got puzzled by question 12 in the 6th chapter.
It goes like:



I think, since the actual serialization code is not included, and also since someone could take complete control of the serialization/deserialization process by implementing writeObject and avoiding the call of defaultWriteObject, i think that C can also be correct. If the question provided actual serialization code , showing e.g. no implementation of writeObject, then correctly, C would be indeed wrong. ( ).
As is, however, i think we should give C a chance.
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Achilleas,
please READ CAREFULLY the reason why option C CANNOT and should NOT be given a chance the answer explains it perfectly, REMEMBER that it is required that classes whose objects you intend to serialize MUST implement the Serializable interface -to the best of my knowledge- instance variables marked with the transient modifier are the ONLY elements that can be manually written using the defaultWriteObject() method.

I hope this helps.
 
Achilleas Achix
Ranch Hand
Posts: 125
Postgres Database BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua Jacob-Obinyan wrote:Hello Achilleas,
please READ CAREFULLY the reason why option C CANNOT and should NOT be given a chance the answer explains it perfectly, REMEMBER that it is required that classes whose objects you intend to serialize MUST implement the Serializable interface -to the best of my knowledge- instance variables marked with the transient modifier are the ONLY elements that can be manually written using the defaultWriteObject() method.

I hope this helps.



Have you READ CAREFULLY what i wrote?
In addition you got it all wrong in the sentence

instance variables marked with the transient modifier are the ONLY elements that can be manually written using the defaultWriteObject() method


1st, it is not the defaultWriteObject() method but the writeObject() method, and 2nd, there is no rule that writeObject() must always call defaultWriteObject() and also must manually deal with transient variables. Transient is just a marker for ObjectOutpuStream to ignore one (or more) variables, in order to avoid NotSerializableException.
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua wrote:


Achilleas,
the question says: "instances of which classes can be serialized???"

We know the FIRST rule, that it is OBLIGATORY that classes whose instances can be serialized MUST implement the Serializable interface (I hope you are aware that this rule is NON negotiable??....)

Take a CLOSE look at the code:


In other to understand perfectly the above explanation you have to recognise first the difference between Is-A and Has-A, AND how they affect serialization.
Taking into consideration the above VOILATION, why should option C be correct???

Thanks in advance for your response.
 
Achilleas Achix
Ranch Hand
Posts: 125
Postgres Database BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at this code:

Collar.java


Animal.java


Dog.java


Now please note, Collar collar is *NOT* Serializeable, Dog d HAS-A Collar collar, yet, (surprise!) Dog d, gets perfectly serialized/deserialized, *WITH* Collar included in its initial form.
Of course along the non serializable HAS-A Collar, also the case with non-serializable ISA Animal is also demonstrated as well.

What would the output be if Animal had only the one-arg constructor? Can you figure this out?
What would happen if I attempted to insert something like : stream.defaultWriteObject() after line 45 and stream.defaultReadObject() after line 39 ?
(Let me answer the second question : Putting the above two lines, is the *ONLY* way that C can be wrong).
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Achilleas,
I am NOT a java guru, I am NOT even certified, I was only trying to make you realize why option C is wrong (according to the logical explanations provided by K & B), if you do NOT agree its okay, I am NOT in a position to argue that with you, you can forward your arguments to the authors of K & B book to explain why C should be added, as for me I AGREE with the K & B options A & B as valid answers untill otherwise proven.

We hope they -K & B- Authors are seeing reading this thread to provide useful explanations. thank you for your understanding.

 
Achilleas Achix
Ranch Hand
Posts: 125
Postgres Database BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua Jacob-Obinyan wrote:as for me I AGREE with the K & B options A & B as valid answers untill otherwise proven.


The above code is the "otherwise" proof, you are looking for.
In addition, you don't have to be a java guru to see what is going on, compile and run this code on your own computer and see what you get.

There is a section about errata in the K&B book, right? I guess you would hold the same stance against those as well, until "otherwise" proven?
Jesus, this is needlessly turning to a rant, because of a single person who was too lazy to do his own homework.
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Achilleas,
thank you very much for your efforts, at this point I want to appeal to you to RESPECT my PERSONAL decision, I have PERSONALLY decided to stay with the K & B option. Please transfer your 'otherwise proof' and complains to the authors of the K & B book. I have a LOT of other studies (CONCERNING THE EXAMS) to spend my limited time on. I hope you understand.
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Achilleas Achix wrote:


Jesus, this is needlessly turning to a rant, because of a single person who was too lazy to do his own homework.

Ikpefua wrote:


Achilleas can you explain the above??? I dont understand what you mean. I NEED an explanation as soon as possible, or I will have to make complains to the organisers of javaranch about the use of UNFRIENDLY language.
 
Achilleas Achix
Ranch Hand
Posts: 125
Postgres Database BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua Jacob-Obinyan wrote:

Achilleas Achix wrote:


Jesus, this is needlessly turning to a rant, because of a single person who was too lazy to do his own homework.

Ikpefua wrote:


Achilleas can you explain the above??? I dont understand what you mean. I NEED an explanation as soon as possible, or I will have to make complains to the organisers of javaranch about the use of UNFRIENDLY language.



I am the one who should report you for spreading confusion about things you don't even seem to understand.
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Achilleas, I have invited a moderator of javaranch to intervene and resolve whatever problems there are.
 
author
Posts: 9050
21
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Achilleas and Ikpefua,

Let's all take a deep breath and chill out a little bit. Remember that people from all over the world are asking and answering questions on this forum. Because of that it's easy to take a simple statement incorrectly, so your first rule should be "patience".

As for this question, Achilleas the general rule for the Java exams is that the code a question shows you is the code you need to see to answer the question. In this case, there can't be other code for class Wheels or for class Dodge. Where would that extra code be located?

Bert
 
Achilleas Achix
Ranch Hand
Posts: 125
Postgres Database BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Bert, thanks for the fine book, it is a fun to read!
I hope you and Kathy are well, healthy and kicking!

I see your point, regarding the question. Maybe there is a difference between "can", "could" and "can instantly be, right out of the box".
I get your point, thanks, so one should form an idea of an average degree of difficulty of the questions, and apply it to all questions.
Questions are not supposed to be neither ultra tricky-hard, nor very easy to answer.
There is a certain spirit, which should be taken into consideration.

The problem with this question, is that the code seems too empty and abstract, that the reader could easily assume that there is more to it.
The notion i would like to stress, is that by taking complete control of serialization, one could serialize even non-transient non-serializable instance
variables.
 
Bert Bates
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Achilleas,

I think you still have some points of confusion here. Try to answer these questions:

- What kinds of things get serialized?
- In the question you listed, is all the code valid?
- Is an 'empty' class still a valid class?

Remember, on the real exam there isn't a lot of room for many lines of code, so it's most typical that you'll see a lot of code scrunched into a few number of lines.

hth,

Bert
 
Achilleas Achix
Ranch Hand
Posts: 125
Postgres Database BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bert.

However the classes are NOT coderanch, and since they are our/mine/yours classes, i don't see any reason why having the examined person *imagine* code for the calls to ser/deser, should not leave open the possibility to imagine code to implement writeObject/readObject inside the Dodge class. You will tell me, but the Dodge class does not have such code!!! Alright i'll tell you!! the question does not have serialization code either! Just try to understand my POV.
If OTOH the classes were coderanch, officially released for the world to use, then Dodge would be doomed to not be out of the box serializable.
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ikpefua wrote:



OFFICIAL MOCK EXAMS TEST QUESTION 25 THE SOURCE IS OUKC (ORACLE UNIVERSITY KNOWLEDGE CENTER).

Which two about using the java.io.Serializable class are true? (Choose two.)

A. If Dog extends Animal, then Animal must implement java.io.Serializable in order to serialize an instance of Dog.

B. If Dog has-a Collar, then Collar must implement java.io.Serializable in order to serialize an instance of Dog.

C. If Dog extends Animal and Animal implements java.io.Serializable but Dog does NOT implement java.io.Serializable, you can serialize an instance of Dog.

D. When an instance of a subclass is deserialized, none of the constructors in it's constructor chain will ever be invoked.

E. If you mark a class's instance variable volatile, and then serialize an instance of that class, the state of the volatile variable will be lost during serialization.

_________________________________________________________________________________________________________________________________

Options B and C are correct. A class's superclasses don't have to implement Serializable in order to be serialized, and if a superclass doesn't implement Serializable then it's constructor will run during deserialization. A transient variable's state is lost during serialization, but a volatile variable's state is not lost.
_________________________________________________________________________________________________________________________________

Hello Bert,
this is official from Oracle, the owers of Java, I have DOCUMENTAL proof of legally adquiring this mock exam. Is this not even more 'abstract' -according to Achilleas- than the question in your book?.
Lets stop bothering ourselves about UNECESSARY arguments, take a deep breath and move forward, I have made a choice AND that choice is K & B AND Oracle. I DONT CARE about any other logics behind this issue.

Thank you very much.

Ikpefua



 
Bert Bates
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Achilleas,

You said,

imagine code to implement writeObject/readObject inside the Dodge class



For the purpose of the exam, you must learn how to read the questions very, very carefully. An important part of studying for this certification is learning how to read the questions precisely. Personally, I think that this is a very justifiable proposition. In the real world, as a software developer, a BIG part of your job will be precise communication. For instance, you might have to work from a specification that someone else created. In that case, you don't get to "imagine" possibilities, you need to implement what's been specified.

So, on the exam, you're not being asked "what could I possibly do to enhance this code". You ARE being asked to look at the code - AS IT STANDS - and make some determination. This is the pattern for almost ALL of the real exam questions you'll encounter.

Does that help?

Bert


 
Mohit Daga
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I hope i am not getting into the middle of something,but I still do not understand my problem with which I started the thread.Hope the question is sensible enough since "There are no dumb questions."B-).Thank you.
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohit Daga wrote:Hi all..
Am studying serialization from the Sierra-Bates SCJP book..Here it says that when we try to serialize/deserialize a transient class variable by writing our own writeObject/readObject method
the return type of the readObject method is void.It goes like-
private void readObject(ObjectInputSteam is)
But isnt the method supposed to return an Object??
Else how do we get the deserialized object?


Hello Mohit, I consulted the official java documentation API http://download.oracle.com/javase/6/docs/api/, and it gives a clue on how the readObject method behaves here is a caption of what they say:

Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures:

private void writeObject(java.io.ObjectOutputStream out)
throws IOException

private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException;

The writeObject method is responsible for writing the state of the object for its particular class so that the corresponding readObject method can restore it. The default mechanism for saving the Object's fields can be invoked by calling out.defaultWriteObject. The method does not need to concern itself with the state belonging to its superclasses or subclasses. State is saved by writing the individual fields to the ObjectOutputStream using the writeObject method or by using the methods for primitive data types supported by DataOutput.

The readObject method is responsible for reading from the stream and restoring the classes fields. It may call in.defaultReadObject to invoke the default mechanism for restoring the object's non-static and non-transient fields. The defaultReadObject method uses information in the stream to assign the fields of the object saved in the stream with the correspondingly named fields in the current object. This handles the case when the class has evolved to add new fields. The method does not need to concern itself with the state belonging to its superclasses or subclasses. State is saved by writing the individual fields to the ObjectOutputStream using the writeObject method or by using the methods for primitive data types supported by DataOutput.

Take note of the very first sentence: The readObject method is responsible for reading from the stream and restoring the classes fields. I think this is the reason why it does NOT return an Object.
_________________________________________________________________________________________________________________________________

N.B. If you click on the link http://download.oracle.com/javase/6/docs/api/, under packages click on java.io, under Interface Summary click on Serializable and you will see the above explanation.

I hope this helps.
 
Ranch Hand
Posts: 432
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Uff..Very Very Long Discussion ..but Yeah could be Useful!
 
Mohit Daga
Greenhorn
Posts: 15
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ikpefua,
Thank you.I had to read through the thing a couple of times to get the hang of it!
 
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Achilleas, I ended up here because I had exactly the same line of thought as you, and I wasn't very happy with the explanation in the book for why C wasn't correct. Class Dodge, as I see it, can be serialized because there is a way to do it.

Never mind, I think this discussion has been pretty much exhausted anyway. What I was wondering, rather, is whether Serialization had indeed been removed from the objectives. Is it confirmed? Can I stop studying for it and concentrate on the other chapters?
 
reply
    Bookmark Topic Watch Topic
  • New Topic