• Post Reply Bookmark Topic Watch Topic
  • New Topic

Whether System is Serializable  RSS feed

 
Martin Jansen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 55770
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Martin Jansen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!