Results 1 to 5 of 5

Thread: Storing data?

  1. #1
    Syntax's Avatar
    Syntax is offline Member
    Join Date
    Jan 2010
    Location
    Georgia
    Posts
    20
    Rep Power
    0

    Default Storing data?

    Basically I've been thinking about possible program ideas for fun at home but I want to be able to store the data. I don't want it to restart every time I open it up. How do I actually store the data?

    Thanks :)
    11th Grade | Beginner Programmer | Looking into College

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  3. #3
    Syntax's Avatar
    Syntax is offline Member
    Join Date
    Jan 2010
    Location
    Georgia
    Posts
    20
    Rep Power
    0

    Thumbs down

    Quote Originally Posted by Fubarable View Post
    Store what data? text? Database type data? Recipes? Details are somewhat important here.

    Much luck
    Actually it isn't really important. It should be able to store anything. Whether it's recipes or instructions on how to cure cancer. +1 Post count much?
    11th Grade | Beginner Programmer | Looking into College

  4. #4
    Newbie666 is offline Member
    Join Date
    Jan 2010
    Posts
    46
    Rep Power
    0

    Default

    The java tutorials have great examples on writing to files, and reading from files.
    Typically using FileOutputStream, FileInputStream and the like.

    Really big index

    as a really small example
    Java Code:
    try
    {
        String inStr;
        Scanner inFile = new Scanner(new FileInputStream("Your_File.txt"));
        while (inFile.hasNextLine())
        {
             inStr = inFile.nextLine();
             System.out.println(inStr);
        }
        inFile.close();
    } catch ( FileNotFoundException fnfe)
    {
        System.out.println(fnfe);
    }
    Last edited by Newbie666; 01-23-2010 at 01:33 AM.

  5. #5
    Syntax's Avatar
    Syntax is offline Member
    Join Date
    Jan 2010
    Location
    Georgia
    Posts
    20
    Rep Power
    0

    Default

    Thanks.

    Ouch looks a little advanced for me. Maybe later on :eek:
    11th Grade | Beginner Programmer | Looking into College

Similar Threads

  1. Storing the data in a file
    By vasavi.singh in forum New To Java
    Replies: 4
    Last Post: 02-20-2009, 05:01 PM
  2. Storing data from text file in ArrayList
    By tjhodge in forum New To Java
    Replies: 1
    Last Post: 02-12-2009, 02:22 PM
  3. Storing and Retrieveing Data Using XStream & xml Files
    By geeeeky.girl in forum New To Java
    Replies: 0
    Last Post: 01-04-2009, 11:24 PM
  4. Storing data permanently
    By shaungoater in forum New To Java
    Replies: 2
    Last Post: 03-10-2008, 05:18 PM
  5. Storing Data
    By Khorod in forum New To Java
    Replies: 1
    Last Post: 08-03-2007, 06:48 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
  •