There are 3 options, and really, there are only 3 options that cover how everyone deals with file storage.
1) Hard code it
Store all your level design and objects hardcoded within the game. It completely alienates a lot of users from modding your game and makes it a little more difficult to do a quick fix in your levels. But, hey… the people will have to crack your entire code base in order to crack the game.
Java has a special serialization method that allows you to save states of its classes. It is a compromise between this option and option 2.
2) Put the data in a text file
This method takes your game data and puts it into a text file. Keep in mind, the extension does not have to be .txt. You can name the extension whatever you want. Also, you do not have to store the data as UTF-8 characters. You can store the data as a mixture of bytes, chars, and longs. As long as you are able to read the data back into the game you are fine.
This covers a lot of ways to store data, and is by far the one used by most indie and development companies working on large games. It includes most scripting languages like Lua, JSON, and XML. It also includes just writing your data into a basic text files under .txt and picture files like jpeg and png. You can also use this method to store data into binary.
The most important aspect is that you are able to read the data in and out of any format you put in the text file.
3) Store it online
This is really an extension of Option 2. But there is a few tools like MySQL and data servers where you can store all your data online and have the clients read off the server data. Of course, your clients will be out of luck if your system goes down, but MMORPG’s and other online gaming outlets all use this method of storing data.
Conclusion
Best way to handle it is possibly Option 2. It takes a little bit longer to write code that’ll be able to allow for custom objects and level design in the game. In the end though, it makes it a lot easier to expand your game to make more levels and objects.