Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Read text from a file and hold in an array

    Hi Im trying to read lines from an external file and hold them in an array for future use using java.
    I can read the file and print its contents but im not sure on the next step to hold the info in the array.

    The information in the file looks similar to this
    00001 1 3 2
    00002 3 2 1

    With first number is the number of a ballot paper and the next three numbers are ranks of three candidates by preference.

    Any help much appreciated

  • #2
    New Coder
    Join Date
    Jan 2011
    Location
    India
    Posts
    31
    Thanks
    0
    Thanked 4 Times in 4 Posts
    You can use some collections like arrayList of objects or something to store the data.
    Create a class with application wide scope and store the details. You can make the static or something depending on your requirement


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •