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: Read Specific value

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Read Specific value

    Hi i need a java code which read specific value from a file.

    Example:
    I have a text file named data.txt

    it contain :

    Customer Name :Sarwar
    Customer Id : 001
    Product Price :2000

    now how can i take value from the file data.txt 001 and 2000 and save them in a another text file named new_data.txt ?

    Can any one help me?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,130
    Thanks
    52
    Thanked 2,286 Times in 2,257 Posts

    Default Re: Read Specific value

    Read the lines in the file, >>> Scanner class could be used
    find the data to be extracted, >>> String class methods here
    extract that data, >>> String class methods here
    write the data to a new file >>> PrintWriter class here
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Read Specific value

    Hi can you explain this? Um Very Beginner with java.... So please can you give me a lil example?

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: Read Specific value

    Please Google the Java tutorials and the Java API as there you will find all of this explained quite well with examples.

Similar Threads

  1. Read input, read file, find match, and output... URGENT HELP!
    By MooseHead in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 3rd, 2012, 11:01 AM
  2. [SOLVED] Read double from console without having to read a string and converting it to double.
    By Lord Voldemort in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: June 26th, 2011, 08:08 AM
  3. OS Specific Java Error
    By JavaStudents in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 4th, 2011, 07:13 AM
  4. OS Specific Jars
    By sinistaDev80 in forum Java Theory & Questions
    Replies: 0
    Last Post: March 26th, 2011, 09:29 AM
  5. Selecting a specific list
    By sapzero in forum Java Theory & Questions
    Replies: 1
    Last Post: January 23rd, 2011, 11:06 AM