How to store 5 numbers from a file into 5 seperate variables?
Ok, I have 5 numbers in a file. Example: 5 8 7 2 1
they are stored in the file just like that with no commas and I need to read that file and store each number into a variable so I can compare each number seperately to another number.
I tried reading the post earlier from someone else but I don't think that this is the same kind of problem.
I could store a seperate file for each number and compare that way, but I am trying to be more efficient and save space. Could someone please tell me how to do this.
Thank you.
how-store-5-numbers-file-into-5-seperate-variables
Thank you for your help sukatoa
I used the scanner class and nextInt() method like you said, and it almost looked similar to the code I posted earlier but I didn't use the has next, and put nextInt() instead of just next when adding to the variables of the type int.
If I had my code in front, I would have posted it for all to benefit if they are as novice as myself.
Thanks again.