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

  • Home
  • SEARCH
  • 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 8260901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:12:56+00:00 2026-06-08T03:12:56+00:00

Possible Duplicate: Why Java needs Serializable interface? According to Serializability in Java docs :

  • 0

Possible Duplicate:
Why Java needs Serializable interface?

According to Serializability in Java docs :

Serializability of a class is enabled by the class implementing the
java.io.Serializable interface. Classes that do not implement this
interface will not have any of their state serialized or deserialized.
All subtypes of a serializable class are themselves serializable. The
serialization interface has no methods or fields and serves only to
identify the semantics of being serializable

Why doesn’t the Object already implement Serializable? Members that we wouldn’t want to be serializable may be made as transient. Why prevent the default Serializability?

  • 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-06-08T03:12:58+00:00Added an answer on June 8, 2026 at 3:12 am

    Potential security hole

    All subtypes of a serializable class are themselves serializable.

    In other words: all classes you ever create, were or will be created are all serializable. transient only excludes fields, not whole classes.

    This is a potential security hole – by coincidence you can serialize e.g. your DataSource with database credentials inside – if the creator of this particular DataSource implementation forgot to make such fields transient. It’s surprisingly easy to serialize random Java object, e.g. through inner classes holding implicit reference to outer this.

    It’s just safer to use white-list of classes which you explicitly want and allow to serialize as opposed to carefully examining your code, making sure no fields you do not desire are ever serialized.

    Moreover you can no longer say: MySuperSecretClass is not serializable (by simply not implementing Serializable) – you can only exclude the guts (fields).

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

Sidebar

Related Questions

Possible Duplicate: Java: Always override equals? should I override equals function for any class
Possible Duplicate: Java: how to check that a string is parsable to a double?
Possible Duplicate: Passing a class (“Country.class”) as an argument in Java I am trying
Possible Duplicate: How can I write a Java application that can update itself at
Possible Duplicate: Java Generics: Array containing generics I have a Java class which contains
Possible Duplicate: Why is Java's Iterator not an Iterable? We all know java's extended
Possible Duplicate: JAX-WS - Map Exceptions to faults I do not normally use java,
Possible Duplicate: Java abstract interface public interface Foo { abstract public void bar(); }
Possible Duplicate: Java - Convert String to enum I have a method that uses
Possible Duplicate: setMaximumSize not working in java I've having trouble with my JFrame subclass.

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.