Persistence

Bruce Eckel’s Thinking in Java Contents | Prev | Next

When
you create an object, it exists for as long as you need it, but under no
circumstances does it exist when the program terminates. While this makes sense
at first, there are situations in which it would be incredibly useful if an
object could exist and hold its information even while the program
wasn’t
running. Then the next time you started the program, the object would be there
and it would have the same information it had the previous time the program was
running. Of course you can get a similar effect now by writing the information
to a file or to a database, but in the spirit of making everything an object it
would be quite convenient to be able to declare an object
persistent
and have all the details taken care of for you.

More by Author

Must Read