Why do we need Serializable Interface since there is no method decl. inside

On working with Serialization in java
I could see that the Serializable Interface is empty without any method inside.
Also, the writeObject() and readObject() accepts only if the Serializable interface is implemented to a class.
What is the use of implementing an empty Interface?
Please clarify.
Thanks in advance.
Regards,
R.Mahendra Babu

The completely empty Serializable is only a marker interface -- it simply allows the serialization mechanism to verify that the class is able to be persisted.

Similar Messages

  • Why does EJB needs two interface???

    Hi All,
    This has been asked by many ppl and many of you might be having
    the correct answer for it. Please tell me....
    Why does EJB needs two interface (Home and Remote Interface)?. Why not one?
    Thanx to all...
    Regards
    GoodieGuy

    Hi Goodie ,
    Its good question and its a very valid one , one has to have doubt
    why two , why not one ..
    Here the answer goes ..
    First of all you need to understand that its a distributed computing technique ie I mean lot of people will be accessing the bean at the same time , right ? OK , you cann't access the bean directly.
    and lastly the stateless and entity beans do instance pooling.
    The very purpose of having two interfaces is
    1) To differnentiate the bussiness logic and life cycle methods .
    2) The home interface inititates life cycle methods like creation , destruction etc .
    3) There are lot of beans in the container , and through home you are
    creating the instance or accessing one of them .
    4) Once you have home object using it we get the remote object ie the instance of the bean that you want to access if stateless any bean can be called , if statefull depending upon the parameter in create method that respective bean is created and invoked .
    In ejb 1.0 and 1.1 even though the bean and the client are in same jvm its assumed that they are remote and in 2.0 Ver we have local this is to avoid network traffic .
    Hope you have got the answer , but if u still need clarification
    read EBRoman book first and second chapters thoroughly and then proceed
    a head.
    Bye
    Mahesh L.
    ============

  • Why do we need serializable?

    Hi,
    I read from the book about serializable, object has to implement serializable interface in order to get transferred across the internet. But I remember that I can use socket class to create a TCP port and transfer plain text across the internet; is that mean if I don't implement serializable I can only transfer plain text? so is that mean after I implement serializable i can pass the whole object across that internet?
    Also, is the RMI already implements the serializable interface by default? Thx.
    Adrian

    plain text across the internet; is that mean if I
    don't implement serializable I can only transfer plain
    text? so is that mean after I implement serializable i
    can pass the whole object across that internet? Yes.

  • Can any one explaing about serializable interface.

    1)why we need serializable interface,when there is no methods in that interface.

    http://java.sun.com/javase/technologies/core/basic/serializationFAQ.jsp#whyserial
    http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html
    http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/serial-arch.html#4539

  • Implementing the Serializable interface

    Hi guys,
    I have a conceptual question about implementing the Serializable interface - since it's only a marker interface (i.e. - it doesn't have any abstract methods) why does Java demand an object to implement this interface in order to be written into a file? What I'm asking is why wouldn't they make the writeObject method's signature
    public void writeObject(*Object* o)
    so any object can get in? What is the point of forcing a class to implement an interface in order to enable it to be written to a file?

    So that serialization requires the explicit consent of the class or superclass/superinterface.

  • Why do we need Segment Reporting?

    Dear Experts,
    Why do we need Segment reporting since Profit Center reporting can do the same?
    Basically what's the difference?
    Regards,
    Abraham

    Hi Abraham,
    This is what IAS -14 AND IFRS -8 says:
    IAS
    Business segment: a component of an entity that (a) provides a single product or service or a group of related products and services and (b) that is subject to risks and returns that are different from those of other business segments. [IAS 14.9]
    IFRS
    that engages in business activities from which it may earn revenues and incur expenses (including revenues and expenses relating to transactions with other components of the same entity)
    So every company which wants to prepare their Financial statements with either IAS or IFRS need to prepare segment wise Balance sheets and P&L accounts also.
    A reportable segment is a business segment which is generating 10% of total revenues and 10% of total profit or loss and which is having 10% of total assets.
    Please get back to me if you need further assistance.
    Regards,
    Ravi.

  • Serializable interface

    I have a dount about with Serializable
    Serializable interface does not have any methods or varialbles, then how can a class be serialized just by implementing Serializable interface. What is happening internally in Java to make this. Pls clear my doubt.
    Thanks
    Srinivas

    Can U pls brief about reflectionSun has a tutorial on reflection that might interest you:
    http://java.sun.com/docs/books/tutorial/reflect/index.html

  • Why does serializable interface has no methods inside it

    Aloha
    Can anyone please help me with this....Serializable interface has no methods inside it.So how is it useful to the user.Also if I am writing a class which implements Serializable how does JVM know what to do.?

    JoachimSauer wrote:
    dannyyates wrote:
    [The JVM] doesn't know about serialisation [...]Sorry for the nitpick, but that's not completely true. The JVM needs to know about serialisation at least at little bitNo.
    since Serialization creates new objects without the code from the constructrs ever being run. ObjectInputStream loads the classes just like any other code would, although it's obviously reading the serialized stream to get that information... and then calls newInstance() on ObjectStreamClass.
    And ObjectStreamClass uses reflection to get a constructor (via java.lang.Class getDeclaredConstructor ) and then uses said java.lang.reflect.Constructor to create a new instance via newInstance()
    There is no JVM magic. It is all Java code. (With the exception of what java.lang.reflect.Constructor does because at the point it dives into sun packages but you could do the same by calling java.lang.reflect.Constructor)

  • Why we require to implement Serializable interface?

    Hi techies,
    I am new to Serialization. Why we require to use Serializable interface for Serializing objects. Since Serializable interface is a marker interface, how it prevents objects not implementing Serializable from being Serialized. Does Java Compiler checks it or how it checks it?

    JavaBreather wrote:
    Since Serializable interface is a marker interface, how it prevents objects not implementing Serializable from being >Serialized. Does Java Compiler checks it or how it checks it?Compiler does nothing but mark the class as implementing the interface. You can then later check whether “objects instanceof Interface" and find out whether or not it is present. As said above, ObjectOutputStream does the same thing.
    Marker interfaces are a misuse of interfaces, and should be avoided. You shouldn't create new ones.Annotations introduce in Java 5 are a generic mechanism of adding metadata to a class.

  • Keynote and pages are now free, but why do i need to pay for them still when there now free?!?

    keynote and pages are now free, but why do i need to pay for them still when there now free?!?

    Users can obtain the iWorks and iLife applications free, if they purchased a Mac after the beginning of October 2013.
    Older Mac purchases require a paid purchase of these applications.

  • I was in a car collision and need proof of my location when I called 911. The Police Dept., refused to respond, since there were no injuries.   Now, I have a dispute with the other driver who is falsely stating accident happened at another intersection. I

    I was in a car collision and need proof of my location when I called 911. The Police Dept., refused to respond, since there were no injuries.
    Now, I have a dispute with the other driver who is falsely stating accident happened at another intersection. In addition of calling 911 twice, I also took pictures of damages. Unfortunately, I did not take pictures of the intersection signs.
    My AT&T carrier states that this info. can only be disclosed by a subpoena. My insurance carrier states that they will not subpoena this info., since it is a civil case only.
    The Police Department does not keep records of calls they do not attend to.
    How can I get this location  info. from my i phone device if at all possible?
    Thanks,
    Pecosa
    iPhone 4, iOS 6.0.1

    Johnathan Burger,
    I did take photos of the damages to car and license plates, but NOT the intersection signs.
    How do I get the GPS Data in the exit data of photos? Please advise.
    Thanks,
    Message was edited by: Pecosa
    Message was edited by: Pecosa

  • For adobe acrobat plug in why do I need MacAfee since I already have CA security on my computer?

    For adobe acrobat plug in why do I need to agree to also have McAfee since I already have CA security on my computer?

    hello, i think this an optional bundling added by adobe - you should uncheck that download option when you don't need it.

  • Why do we need a Home Interface?

    Hi Guys,
    I am new to EJB. i am some questions.
    1) Why do we need a Homeinterface?
    2) Where does container generated classes for both the interface located(assume we have 2 machine, one is client and another is server)
    In RMI we hv stubs and skeletons located in client and server side....similarly how it is designed in EJB?
    Thanks & Regards
    -vijay

    In EJB3.0 the home interface has been removed. The purpose of home interface was to serve as a factory for finding/creating/destroying an enterprise bean instance. I am not sure why exactly the architects of ejb created a home interface. May be they thought its better to have a clear seperation of responsibilities, that is home interface for the above said purpose and component interface (a.k.a remote interface) for executing the business methods. Also you need to understand that the client never deals directly with a bean instance. The client always calls a bean's home or remote interface methods whose execution is delegated to the actual bean instance. This mechanism provided more flexibility for the container in creating and managing enterprise bean's instances. Hope this helps.

  • I need help why does i send to this friend there is a redbox + x

    i need help why does i send to this friend there is a redbox + x , but i send to other friend there is no problem. for anorid samung s3 phone

    Are you sure you have the right pin for your other friend? Try deleting the contact and re-adding them. Also, BBM has to be approved in the countries of both parties.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • Since there is a nasty virus out designed for Apple do I need a virus protection program?

    Since there is a nasty virus out designed for apple, do I now need a virus protection programm?

    Mac OS X versions 10.6.7 and later have built-in detection of known Mac malware in downloaded files. The recognition database is automatically updated once a day; however, you shouldn't rely on it, because the attackers are always at least a day ahead of the defenders. In most cases, there’s no benefit from any other automated protection against malware.
    The most effective defense against malware is your own intelligence. All known malware that affects an up-to-date Mac OS system takes the form of trojans that can only operate if the victim is duped into running them. If you're smarter than the malware attacker thinks you are, you won't be duped. That means, primarily, that you never install software from an untrustworthy source. How do you know a source is untrustworthy?
    Any website that prompts you to install a “codec,” “plug-in,” or “certificate” that comes from that same site, or an unknown site, merely in order to use the site, is untrustworthy.
    A web operator who tells you that you have a “virus,” or that anything else is wrong with your computer, or that you have won a prize in a contest you never entered, is trying to commit a crime with you as the victim.
    “Cracked” versions of commercial software downloaded from a bittorrent are likely to be infected.
    Software with a corporate brand, such as Adobe Flash Player, must be downloaded directly from the developer’s website. No intermediary is acceptable.
    Disable Java (not JavaScript) in your web browser(s). Few websites have Java content nowadays, so you won’t be missing much. This setting is mandatory in Mac OS X 10.5.8 or earlier, because Java in those versions has bugs that make it unsafe to use on the Internet. Those bugs will probably never be fixed.
    Follow these guidelines, and you’ll be as safe from malware as you can reasonably be.
    Never install any commercial "anti-virus" products for the Mac, as they all do more harm than good. If you need to be able to detect Windows malware in your files, use ClamXav — nothing else.

Maybe you are looking for

  • Want songs in playlist but not in library

    so i have a CD with thousands of short japanese recordings on it, the only way i believe that i can get them onto my iphone/ipod is through adding them to itunes. However when i hit shuffle songs the likelihood of getting a japanese recording instead

  • Opinion of K8N Neo Platinum?

    G'day: I want to get upgrade my ASUS K8V Deluxe MB for something that will lock the PCI and be able to OC beyond 10x210.  This system has been running for over a year with 2x512 Infineon RAM, 2-160Gb Wd SATA (RAID 0), 2x80 GB IDE, ATI 9200, LG 2x DVD

  • Exception using JAXP transformer on non-default DOM

    Hi! I have a problem with the JAXP integration of my own DOM implementation. I've written a compressed core level 1 DOM implementation and integrated it into JAXP by writing a DocumentBuilder and a DocumentBuilderFactory class. Although not 100% of a

  • Change in the MAD dates in delivery

    HI, I have a strange issue , I have 2 orders with different line items ( Partial delivery permitted but partial qty. for each line item not permitted ) . First order has an Item A with MAD = 10.02.09 Second order has an item B with MAD = 09.02.09 Whe

  • Zone path location question

    I am rebuilding our Zone hosting server and the Zone paths are currently located on the SAN through an iscsi mount. My question is: If I plan to use Live Upgrade should the zone paths be in the root partition instead? Also, if you have any suggestion