• Post Reply Bookmark Topic Watch Topic
  • New Topic

ObjectOutputStream?

 
Blanka Li
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In jdk1.4 javadoc api, java.io.ObjectOutputStream.writeObject(Object obj). But in the book of Complete Java2 Certification Study Guide, it says "The argument type for the writeObject() method of ObjectOutputStream is not Object but Serializable". Why difference?
thanks
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as stated by the API the correct answer is Object.
however, every object you write must be also Serializable , if not it will throw an exeption or wont work correctly.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"blanka"
Please review the JavaRanch Naming Policy then edit your profile so that your publicly displayed name complies with the rules.
Thanks for your cooperation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!