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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:39:50+00:00 2026-05-23T11:39:50+00:00

In Serialization, the class which we want to be serialized has to implement the

  • 0

In Serialization, the class which we want to be serialized has to implement the Serializable interface, otherwise a NotSerializableException is thrown. There are many other examples like that in the various features of Java. Now I just want to know how to bring in such control in custom classes and interfaces. I have an interface called Agent. There can be many different types of Agents, all of them must implement the Agent interface. I also have a class called Node. Nodes create Agents. Now how to bring in control in such a situation, such that an agent always much implement Agent interface, otherwise an exception will be thrown. I might sound a bit vague, but if someone can provide me with the general idea, then I can provide further details if necessary.

  • 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-23T11:39:51+00:00Added an answer on May 23, 2026 at 11:39 am

    If you have a Node method which must take an Agent, you specify that the argument has to be an Agent.

    interface Node {
        void method(Agent agent); // must be an Agent.
        Agent returnAgent(); // must return an Agent.
    }
    

    Serialization is a special case. This is because not all types which are serializable are Serializable. Built in types like int[] is serializable but doesn’t implement Serializable. This type of check cannot be done by the compiler and can only be done at runtime.

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

Sidebar

Related Questions

I've got a class which implements it's own (de)serialization via XLINQ, and I'd like
I want to XML-Serialize a complex type (class), that has a property of type
I have two classes SccmAction and TicketAction which both implement interface IDelivery. These classes
Does anyone want a framework/class which allows me to clone by values .Net objects?
my class property has default value which will be serialize. public class DeclaredValue {
I have the following class which throws an InvalidOperationException when the class is serialized
I have a generic abstract UserControl class, SensorControl , which I want all my
We're seeing a crash when instantiating an instance of the System.Xml.Serialization.XmlSerializer class in a
I imagine to use XML serialization like this: class Foo { public Foo (string
public sealed class SurrogateSelector : System.Runtime.Serialization.SurrogateSelector, System.Runtime.Serialization.ISurrogateSelector { System.Runtime.Serialization.ISerializationSurrogate ISS = System.Runtime.Serialization.FormatterServices.GetSurrogateForCyclicalReference(new SerializationSurrogate()); public

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.