Results 1 to 3 of 3
  1. #1
    NotTooOld is offline Hostage
    Join Date
    Apr 2013
    Rep Power

    Default BufferedWriter, and other weird problems

    I fixed it. Delete this post please.

    Kinda funny how writing for help let's me see the problem more clearly.
    Last edited by NotTooOld; 05-06-2013 at 07:36 AM.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    New Zealand
    Rep Power

    Default Re: BufferedWriter, and other weird problems

    Not strange at all!

    I often find the same thing. I put it down to the following: often it's the problem that's unclear, not the solution. So writing down the problem - and especially making it clear to people who don't know all the background - is just the sort of thinking that allows some other part of our brain to say "of course".

    Often on this site you'll see people say "post a SSCCE!". It's the same thing: problem solving is really problem describing and problem specifying. Solving is the easy bit.
    Last edited by pbrockway2; 05-06-2013 at 07:49 AM.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: BufferedWriter, and other weird problems

    @OP: please don't edit out your original question; that leaves the entire thread useless for future readers.

    The original contents was:

    This is freakin me out. I've combed the internet and tried every example and tutorial I can find, and still get very strange results. I'm trying to write the values of a String array to a text file.(Each value on it's own line.) Simple huh? So where is my code wrong? If you can help, I don't mind you calling me a "noob," or stupid. I just don't want to spend another day fighting with this.
    Java Code:
     public static void writeFile(){
     String path = "C:\\TestFile.txt";
     File theFile = new File(path);
     String array[] = new String[8];
     array[0] = "I love";
     System.out.print(array[0] + " ");
     array[1] = "you";
     System.out.println(array[1] + ".");
     array[2] = "I love";
     array[3] = "you";
     array[4] = "I love";
     array[5] = "you";
     System.out.print(array[5] + ", ");
     array[6] = "I love";
     System.out.println(array[6] + ". This is array[5] and [6]");
     array[7] = "you";
     try {
     System.out.println(path + "Begining of try...");
     BufferedWriter writer = new BufferedWriter(new FileWriter(theFile));
     for (int i = 0; i < array.length; i++){
     System.out.println("array has " + array[1]+ " at index " + i );
     if (writer != null){
     catch (IOException e) {
     finally {
     System.out.println("File Saved: \n" + path);
    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Problem with BufferedWriter
    By salmontres in forum New To Java
    Replies: 5
    Last Post: 12-09-2011, 07:06 PM
  2. Replies: 11
    Last Post: 09-18-2011, 12:01 PM
  3. BufferedWriter Problem
    By dailywalker in forum New To Java
    Replies: 3
    Last Post: 04-04-2011, 10:07 PM
  4. BufferedWriter
    By Karthika in forum New To Java
    Replies: 6
    Last Post: 04-22-2010, 09:23 AM
  5. Weird java problems
    By debylni in forum Advanced Java
    Replies: 5
    Last Post: 03-10-2010, 02:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts