Broadly, there are two ways: save the
Java objects directly using serialization, or define a structured file format to translate your objects into as they are saved. Serialization is easy, but opaque and potentially fragile if your code changes. Defining and using a custom file format may or may not be difficult. It might be something you define from scratch, or you could just use an established format like XML. The advantage of using something like XML is you can use a pre-existing parser and tools for writing the file format.