| Author |
Whether System is Serializable
|
Martin Jansen
Greenhorn
Joined: Oct 22, 2010
Posts: 9
|
|
I have a question about the Sharpen your pencil exercise of Head First Java 2nd Edition, page 465: is object type System serializable? I think not, because it cannot be instantiated and it has some methods with stream objects so it is already serialized. But if this is not the right answer i like to hear from you!
Because i learn Java by selfstudy and using the Head First Java book, i cannot ask a teacher to explain this.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 26713
|
|
|
Please consider where to post, and don't add a new question to an existing topic. I am not sure I understand your question, but it can probably be answered easily by looking up the class in the API documentation.
|
 |
Rob Spoor
Saloon Keeper
Joined: Oct 27, 2005
Posts: 18365
|
|
Only instances can be serializable, and java.lang.System cannot be instantiated.
Also, a major indicator of whether a class is serializable or not, is by checking if it (directly or through some super class) implements java.io.Serializable.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Martin Jansen
Greenhorn
Joined: Oct 22, 2010
Posts: 9
|
|
Only instances can be serializable, and java.lang.System cannot be instantiated.
--> That's what i also thought, so thank your for thinking with me!
Also, a major indicator of whether a class is serializable or not, is by checking if it (directly or through some super class) implements java.io.Serializable
--> In the API i see the System class don't implements java.io.Serializable.
Question is answered!
|
 |
 |
|
|
subject: Whether System is Serializable
|
|
|