Saving entered information
What should I look into to be able to save entered information.
for example: I write a address book and of course you would like to save the information you enter, how would I go about saving the information. Do I need to connect to a DB or can is be saved without another application, like its own file that can be reopened when the program is started.
Thanks
[379 byte] By [
Djanvka] at [2007-11-27 7:46:29]

You can use classes in java.io to write things to a file. You can then create your own protocol for how to interpret the data from the file. You can also use a properties file in conjunction with the Properties class, which makes the protocol for you.
For instance, if you're using an address book, here's a simple way to store addresses to later be loaded, where the \n's represent new lines, and separate each item from each other:
Firstname1 Lastname1 Streetnumber Streetname St./Rd./etc. City State Zip_Code
\n
Firstname2 Lastname2 ...
\n
Note that if you have to search for a certain address, given a certain name, it will be an O(n) operation... in these cases alternative databases, such as SQL databases, are preferred.
Anyways, you should google "java file io" and read some tutorials on it.
It may be a bit overwhelming, but you can use an "embedded" database, which is basically similar to a M$ Access file (sorry for the analogy :)). Here's one:
http://www.hsqldb.org/
The advantage is that your code is ready to be used with a server-based database then, it's just a question of the JDBC configuration.
If you want to avoid direct JDBC programming, you might want to check this out, altough it's complex enough on its own:
http://www.hibernate.org/
Has object serialization been mentioned? It's main attribute is that it's 100 times
easier that using a database, although in the fullness of time, this application
sounds destined to use a database :-)
http://java.sun.com/docs/books/tutorial/essential/io/objectstreams.html