I have a text file that looks like this,

John, 27, Kids, Married
Jane, 22, No Kids, Single

and so on...

I have read in the text file as seen below,

Scanner scan = new Scanner(System.in);


System.out.print ("Enter the name of the input file: ");
fileName = scan.nextLine();
fileScan = new Scanner(new File("in.dat"));



while (fileScan.hasNext())
{
fileName=fileScan.nextLine();


lineScan = new Scanner (fileName);
lineScan.useDelimiter(",");
String name=lineScan.next();
String team = lineScan.next();
int year = scan.nextInt();
String condition = lineScan.next();
double price = scan.nextInt();

What I am trying to do is figure out how I can scroll down through the text file and add each line to an array.

My Array would have i.e MyArray[] = (String name,String team,int year ,String condition ,double price )

I am totally confused on how to get that text file into an array...

well if we are trying to do that, then i would avoid putting a delimeter of a comma, since that will break up the lines at every single comma. A good delimiter would be the end of line signal, \n (for window systems)
(if the file is saved in *nix it would be \r\n )

lineScan.useDelimiter("\r\n");
String line = sc.next();

once you have all the lines of code in an array if you wanted to seperate them you could simply use StringTokenizer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.