Results 1 to 2 of 2
  1. #1
    Gum is offline Member
    Join Date
    May 2012
    Rep Power

    Default Getting Java To Use Values In A Text File

    I'm a beginner programmer, and I want to use values written in a text file in my java program.

    I don't want to enter the strings directly into the program code.

    It is difficult to explain, but I'll try. I have a text file with:

    Title: Lost in the subway
    situation1: you wake up on a bench in a subway tunnel. Do you:
    action1: talk to the old lady at the platform
    action2: wait for the train
    situation2: the old lady looks away
    action3: poke her

    And I want Java to read the text file and display "Lost in the subway" as a title.
    Then I want to display situation1, and then display the corresponding actions.
    And then there is this in another text file:
    s1: a1, a2
    s2: a2, a3

    And I want java to use this to display the actions that correspond with the situation.

    If anyone could help me with this, that would be wonderful. I want to be able to write lots of stories, and not have to mess with the java code every time.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Getting Java To Use Values In A Text File

    I'd recommend doing a quick google search of "java file io" as a first stab.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

Similar Threads

  1. Problems with writing String values to a text file
    By Tedward in forum New To Java
    Replies: 8
    Last Post: 06-02-2011, 04:28 AM
  2. Extracting values from a text file
    By kryptonian03 in forum New To Java
    Replies: 4
    Last Post: 03-22-2011, 07:13 AM
  3. Replies: 14
    Last Post: 01-22-2011, 03:36 PM
  4. Replies: 40
    Last Post: 07-04-2008, 08:41 AM
  5. [SOLVED] getting values from a text file
    By dav9999 in forum New To Java
    Replies: 8
    Last Post: 04-01-2008, 01:51 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