Zobair Imran wrote:Dear Assistant,
I while observing this side >" http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=303&p_certName=SQ1Z0-851 " find a little bit mistake with Sample Questions.
Which is below:
OBJECTIVE: 3.3: Develop code that serializes and/or de-serializes objects using the following APIs from java.io: DataInputStream, DataOutputStream, FileInputStream, FileOutputStream, ObjectInputStream, ObjectOutputStream, and Serializable.
4) Given:
2. import java.io.*;
3. public class Network {
4. public static void main(String[] args) {
5. Traveler t = new Traveler();
6. t.x1 = 7; t.x2 = 7; t.x3 = 7;
7. // serialize t then deserialize t
8. System.out.println(t.x1 + " " + t.x2 + " " + t.x3);
9. }
10. }
11. class Traveler implements Serializable {
12. static int x1 = 0;
13. volatile int x2 = 0;
14. transient int x3 = 0;
15. }
If, on line 7, t is successfully serialized and then deserialized, what is the result?
a) 0 0 0
b) 0 7 0
c) 0 7 7
d) 7 0 0
e) 7 7 0 (*)
f) 7 7 7
REFERENCE:
API
Option E is correct. Fields declared as transient or static are ignored by the deserialization process.
My Question is according to this Code the result comes
7 7 7
Press any key to continue...
But we see the answer which is above does not similar to the real one, that is above reference says the ans. is 7 7 0
What should be in correction ? If 7 7 7 is right should the authority make their page correct?
thanks for the patient.
Sincerely,
Zobair
Zobair Imran wrote:
Thanks for your reply. Actually I asked that in your sample question and answer sheet the answer of that question is 770,
but same code when I run in my laptop it says the answer is 777. And that is what my question was. I really did not do anything changed with that code just copied and pasted.
So my question on what basis are you saying the answer is 7 7 0 while I am seeing the answer is 7 7 7.
To be frankly speaking I did not do ever serializing and then deserializing.
May be I myself am confused!. Anyways, Hope you did not mind.
By the way I am really pleased to meet you that it is you Mr. Henry Wong who wrote the book JAVA Threads 2nd Edition replied to me!!! WOW! it feels great.
can you tell me how far changes are there in your new I mean 3rd Edition. After all it is after 1999.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |