Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1072343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:50:52+00:00 2026-05-16T20:50:52+00:00

I have a question about Object serialization and deserialization when class field changed. If

  • 0

I have a question about Object serialization and deserialization when class field changed.

If an object with type MyClass

MyClass {
    String str1;
    LinkedList mylist = new LinkedList();
    String str2;

}

has been serialized to file.

Then I changed the code which changes MyClass definition to

MyClass {
    String str1;
    LinkedList mylist = new LinkedList();
    Map myMap = new HashMap();

}

After that, I deserialize the object from file to a MyClass object using the changed code. Is it OK? Will there any exception thrown during deserialization? I want to reuse the old object. I.e. I want the de-serializing can be done. So I hope there is no exception thrown.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:50:55+00:00Added an answer on May 16, 2026 at 8:50 pm

    No, on the contrary, you’ll run into great problems. In Joshua Bloch’s Effective Java, Item 74, he notes to implement Serializable judiciously, as it decreases the flexibility to change a class’s implementation once its been released.

    He specifically notes that “If you do not make the effort to design a custom serializable form, but merely accept the default, the serialized form will be forever tied to the class’s original internal representation.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi: I have a question about how to design and map object class in
I have question about removing element from QList. myclass.h: class node2D : public QObject
I have a question about Parallel Object Hierarchies such as DTO. Theses hierarchies has
I have a question about how to limit the creation of object on heap
Hi I have a question about this pointer, when an object is constructed, when
I have a question about object relational updates on join fields. I am working
I have a question about access to object properties that will be used in
i have question about two different Bundle object in below methods : onSaveInstanceState(Bundle outState);
I have a question about different versions of an object, their sizes, and allocation.
i have a question about the CGLayerRef elements ( because they are not object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.