The Artima Developer Community
Sponsored Link

Java Buzz Forum
Serializable Externalizable in Java Serialization

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Javin Paul

Posts: 1090
Nickname: javinpaul
Registered: Jan, 2012

Javin Paul is Java Programmer working on Finance domain.
Serializable Externalizable in Java Serialization Posted: Jan 20, 2012 6:52 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Javin Paul.
Original Post: Serializable Externalizable in Java Serialization
Feed Title: Javarevisited Blog
Feed URL: http://javarevisited.blogspot.com/feeds/posts/default?alt=rss
Feed Description: Blog on Java, Unix, Linux, FIX Protocol technology. I share my experience as tutorial, article, interview questions, programming, design etc.
Latest Java Buzz Posts
Latest Java Buzz Posts by Javin Paul
Latest Posts From Javarevisited Blog

Advertisement



Difference between Serializable and Externalizable in Java Serialization

Difference between serializable and externalizable is popular java interview question which we have touched on my earlier post on Serialization: Top 10 java serialization interview questions. knowing differences between externalizable and serializable is not just important from interview point of view but also getting control of serialization process and optimizing performance of serialization. both serializable and extenalizable used to serialize or persist java objects but the way they do is little different. In case of Serializable Java Virtual machine has full control for serializing object while incase of Externalizable, application gets control for persisting objects. writeExternal() and readExternal() method provides complete control on format and content of Serialization process to application which can be leverage to increase performance and speed of serialization process.


Serializable vs Externalization in Java

difference between Java Serialization vs Externalization in Javahere are some more differences between Serializable and Externalizable interface in Java:

1. In case of Serializable, default serialization process is used. while in case of Externalizable custom Serialization process is used which is implemnted by application.

2. JVM gives call back to readExternel() and writeExternal() of java.io.Externalizalbe interface for restoring and writing objects into persistence.

3. Externalizable interface provides complete control of serialization process to application.

4. readExternal() and writeExternal() supercede any specific implemntation of writeObject and readObject methods.

Though Externalizable provides complete control, it also presents challenges to serialize super type state and take care of default values in case of transient variable and static variables in Java. If used correctly Externalizable interface can improve performance of serialization process.


That’s all on Difference between Externalizable and Serializable interface in Java. This is always asked when Java interview take turn towards Serialization after Multi-Threading questions and Collections Interview questions. Only problem with Serialization is that not many programmer use it and that’s why it look little difficult otherwise once you familiar with Serialization process and rules of Serialization, interview questions can be more easily handled.


Some Interview Questions post:

Read: Serializable Externalizable in Java Serialization

Topic: IntelliJ IDEA’s Move Refactoring for ActionScript/Flex gets Smarter Previous Topic   Next Topic Topic: Eclipse Code Formatting Tips

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use