Best file format to store Name and Value

I'm creating a program in which I need to store an item name, and a value. The program will randomly choose things from the list based on the total value being lower then a set limit, and then printing the names of those items. What would be the best file to store this in? I was looking at an .ini file, but that seems to be for settings and such. Any help would be greatly appreciated.

Upvotes: 0

Views: 778

Answers (2)

Ravindra babu
Ravindra babu

Reputation: 38930

In that case, use XML and preferences.

Have a look at my post to set Preferences from XML : Loading a map using Properties class

Have a look at Example 1 and Example 2 links to write XML from java.

Upvotes: 0

Leo
Leo

Reputation: 6570

The typical key-value text file storage in Java is the Properties.

See an example here.

Upvotes: 4

Related Questions