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: Apprending a print writer file

  1. #1
    Member
    Join Date
    Feb 2013
    Posts
    67
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Apprending a print writer file

    Im having trouble apprending a file which has to have a hash map plus have data before it. it only does one at a time

    if(customerMap.size()> 0)
    {
    PrintWriter nw = new PrintWriter(new FileWriter(newFile1,true));
    nw.print("hi"); //this is the extra information


    for(Customer customers: customerMap.values()) // hash map
    {

    customers.writeData(nw);

    }

    }


  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: Apprending a print writer file

    Can you explain what happens when the program executes and describe what the problem is?
    Please make a small, complete program that compiles, executes and shows the problem.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member
    Join Date
    Feb 2013
    Posts
    67
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Apprending a print writer file

    doesnt matter know ive added a second print writer to do it and it works

  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: Apprending a print writer file

    sounds like a poor work-around instead of a clean solution.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Print Writer Problem
    By ajw1993 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 16th, 2013, 03:50 PM
  2. Print to txt file
    By anmason in forum What's Wrong With My Code?
    Replies: 5
    Last Post: March 8th, 2013, 09:19 AM
  3. Read Writer button wont add to file.
    By miller4103 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 14th, 2013, 08:08 AM
  4. Replies: 1
    Last Post: December 3rd, 2012, 02:35 PM
  5. [SOLVED] Buffered writer in a .jar file
    By lorider93p in forum Java Theory & Questions
    Replies: 8
    Last Post: February 8th, 2012, 01:03 PM