Results 1 to 3 of 3
  1. #1
    GowerL7 is offline Member
    Join Date
    Nov 2011
    Rep Power

    Default Reading from file


    I am new to java and wish to implement a program, that will read numbers from a text file, put them into an array so that I can then perform an Insertion sort on them.

    I have managed to get an insertion sort working so far, with a fixed array, but can not do it reading an array from file,

    any help would be appreciated.



  2. #2
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Rep Power

    Default Re: Reading from file

    We can't help you without seeing your code.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Reading from file

    Your sort code should work the same no matter where you get the data to be sorted from.

    What code are you using to read the data with?
    The Scanner class has some easy to use methods.
    Or do a Search on the Forum for readLine() to get sample code for using the BufferedReader class.

Similar Threads

  1. Reading file external to jar file
    By nn12 in forum New To Java
    Replies: 6
    Last Post: 02-04-2011, 05:46 AM
  2. reading a file and writing to a!!!!
    By java_prgr in forum New To Java
    Replies: 3
    Last Post: 07-26-2010, 06:53 PM
  3. Replies: 9
    Last Post: 10-20-2009, 10:52 AM
  4. Replies: 3
    Last Post: 05-09-2009, 11:31 PM
  5. Help for reading a doc file
    By thehero in forum New To Java
    Replies: 1
    Last Post: 02-24-2009, 06:44 AM

Posting Permissions

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