what does the ( java.io.Serializable) do?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rafah
    New Member
    • Mar 2014
    • 5

    what does the ( java.io.Serializable) do?

    I just want to know what is the work of(java.io.Seri alizable),how can i use it ?
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    The work is: to save and load complex objects to file or database.
    You can use it by implementing the serializable interface for your class (object) and then call the serailizable methods on your object

    Comment

    • Nepomuk
      Recognized Expert Specialist
      • Aug 2007
      • 3111

      #3
      To add to chaarmanns answer: The interface itself has no functionality and it defines no functions that have to be implemented. It is what you call a marker interface; classes can implement it and thereby say "you can serialize me and everything inside me (that I haven't explicitly marked otherwise)". The latter is not enforced but expected by some tools.

      To learn more about the Serializable interface, I'd recommend reading the JavaDoc.

      Comment

      Working...