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 8958395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:12:13+00:00 2026-06-15T15:12:13+00:00

class A implements Serializable{ } class B extends A{ //this also inherits the marker

  • 0
class A implements Serializable{

}


class B extends A{
    //this also inherits the marker 

}

So is there is a way to unimplement/unmark the marker within class B?

Example: If there are two classes extending A named B and C. But out of them only C wants to be serializable and not B.

  • 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-15T15:12:14+00:00Added an answer on June 15, 2026 at 3:12 pm

    It isn’t just that Java is missing support for this: such a feature would completely break down its OOP foundations. Type polymorphism means that one can apply Liskov’s substitution principle on subtypes: your “feature” would render it inapplicable.

    Every subtype is bound tightly by the contract of the type it extends: at each place one refers to the supertype, an instance of subtype must be able to occur. Therefore if the supertype is serialiable, we cannot allow any subtype not to be.

    Answering from a different perspective, if you need functionality from the serializable type A in a non-serializable type B, then base your design on composition instead of inheritance: let B include an appropriate instance of A.

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

Sidebar

Related Questions

class Parent implements Serializable{ ........ } class Child extends Parent{ private void writeObject(ObjectOutputStream oos)
In 2 java classes , If class A implements Serializable and class B extends
public class StoreMessage extends Thread implements Serializable{ private static long start_nanotime=System.nanoTime(); private static int
Accoriding to javadoc, public class AtomicInteger extends Number implements java.io.Serializable { // code for
mI've this entity class: @Entity public class User implements Serializable { @Id @GeneratedValue(strategy=GenerationType.AUTO) private
I have two objects as follows public class MyObject1 implements Serializable { private Long
I'm developing an application. This application contains 2 classes Discovery class which implements serializable
@Entity public class TestClass implements Serializable{ private Integer id; private Set<String> mySet; @Id @GeneratedValue
My jpa looks like below public class TESTClass implements Serializable { ... private String
I have class Money which is an @Embeddable @Embeddable public class Money implements Serializable,

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.