Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Doubt on a logic to store constant in file.

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    3
    My Mood
    Amazed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Doubt on a logic to store constant in file.

    Hi,

    In my project I need to store 5 rows of values as follows but not in DB and should be editable when needed.

    Id Code Type Place
    1 code_1 type_1 Canada
    2 code_2 type_2 India
    ... ... ... ...

    How this can be done in a better way ?

    Condition : The file I am going to store this should not be a class file.
    It can be comma (or any special character) separated. No issues in how it is stored in.

    I know that it can be stored in a text file and can fetch when needed. But I need a simplest and a good way to achieve this.
    Last edited by smilyface; August 23rd, 2012 at 11:43 AM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Doubt on a logic to store constant in file.

    Look at the FileWriter or PrintWriter classes.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    3
    My Mood
    Amazed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Doubt on a logic to store constant in file.

    Thank you Norm for your quick reply.

    I forget to mention that it is a web based project. Will it be good / make any problem if I am using fileWriter/PrintWriter ?

    And I was expecting something different as I told in the last line of my first comment.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Doubt on a logic to store constant in file.

    Please explain what you mean by "web based". Do you mean an applet or a server?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Annotation on enum constant.
    By Doctor X in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 22nd, 2012, 09:43 AM
  2. Create a file named .txt and store it in directory
    By ITStudent02 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 28th, 2011, 03:48 PM
  3. Store HexDecimal Color Code in .properties file?
    By techwiz24 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 27th, 2011, 08:45 PM
  4. Help with making the user input to store in file
    By dannyyy in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 6th, 2011, 06:52 AM
  5. Read A File and Store Values into a 2-Dimensional Integer Array?
    By Kimimaru in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 9th, 2011, 09:13 PM

Tags for this Thread