I have a project for CSC220 that requires me to write a program that can read 35 different first names, last names, and email addresses from a text file. I am then to take these names and input them in a format that has the first name, last name, and email address seperate from eachother. I know how to read from the text file, but I can't figure out to make it so I can assign the first name to name1, the last name to name2, and the address to email. Instead, i've only been able to get it to print out all of it at once. can anyone point me in the right direction? It would be much appreciated
You might want to take a look at the Scanner class. It can break Strings up in so called tokens. By default, each token is considered to be everything separated by whitespace, which should be perfect for your problem.
Specifically, take a look at the methods hasNext() and next(), in the Scanner class.