the fields are separated by commas. the first field is the menu item number, the second is the type, the third is the code, the fourth is the size and the fifth is the price.

i used the buferedreader class to make a bufferedreader object so i can access my file and read from it. then i used a while loop to read all the lines of data in text file. but when i print out my results the block of statements i did winded up putting all the fields onto one element in the array.

catch (Exception e) //this fixes an error just in case
{
System.out.print("DOH!"); //this does block does the action
}

}

}

can anyone tell me what i did wrong? did i use a wrong type of loop to try and make the array? Also how can i make a string object of each line of data so that it can be accessed by any other class in program?

did i use a wrong type of loop to try and make the array? Also how can i make a string object of each line of data so that it can be accessed by any other class in program?

each line you read is overwriting the previous readed string. if you want to keep all readed lines in memory my suggestion is: make a class Pizza with a constructor that takes all readed pizzaArray (menuItemNumber, pizzaArray etc.) and methods for adding pizzas etc. and then instantiate an ArrayList of type Pizza.

each line you read is overwriting the previous readed string. if you want to keep all readed lines in memory my suggestion is: make a class Pizza with a constructor that takes all readed pizzaArray (menuItemNumber, pizzaArray etc.) and methods for adding pizzas etc. and then instantiate an ArrayList of type Pizza.

so how would i make another class to get the arrays my loop is making. i also need each line of data to be an object so that i can associate the pizza type with the price. so when the user inputs a pizza type then the price that is associated with it can also appear.

can anyone please put up some sample code that i can work with. i need a rough idea to point me in the right direction.

thanks again for all the replies so far. they have been very helpful. :D