Methods of storing permanent data in java

Yoosuf picture Yoosuf · Aug 27, 2010 · Viewed 17.8k times · Source

I am currently doing a programming assignment and it says that we should "store all the data in a data file and need to check the compatibility of the user PIN and account no. validity"

Unfortunately my lecturer has not taught us about data files, and when I googled I found two different answers,

  1. Store data in notepad (.txt) file
  2. Store data in csv file

MY QUESTION IS WHICH ONE IS A DATA FILE? and how do you retrieve the user PIN (after its typed from buffer reader) to check whether both are correct? Any Help is GREATLY APPRECIATED!!

Answer

KristofMols picture KristofMols · Aug 27, 2010

from wikipedia:

A data file is a computer file which stores data for use by a computer application or system.

So both a *.txt file and a *.csv file are data files.

A *.csv (comma-seperated values) file is in essence a *.txt file that separates your values by a ,

The 2 methods you found should do about the same, but it will be easier to use the csv-method.