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 2 of 2

Thread: Basic Java File I/O with Scanner Class Problem

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default [Solved] Basic Java File I/O with Scanner Class Problem

    If the equation is this:

      String name;
      Scanner inputFile = new Scanner(new FileReader("dogNames.txt"));   
      PrintWriter outputFile = new PrintWriter("doggoneData.txt");

    insert code here

      inputFile.close();
      outputFile.close();


    I think it is along the lines of including
    name = "Tippy";
    outputFile.write(name);
    outputFile.println();
    but I am unsure of how to write the correct answer. Can someone help me?
    Last edited by miss confused; July 25th, 2010 at 10:10 PM. Reason: Solved


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Basic Java File I/O with Scanner Class Problem

    Hello miss confused.

    I have just seen your edited comment.. Is this thread solved?

    If not, can you please give some more information? Are you looking to read the file dogNames.txt and write out to doggoneData.txt?

    What does the content of dogNames.txt look like?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Scanner class error "java.lang.Error"
    By Lheviathan in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 21st, 2009, 02:23 AM
  2. How to link two classes in java to use it method
    By Sterzerkmode in forum Object Oriented Programming
    Replies: 3
    Last Post: May 13th, 2009, 06:52 AM
  3. Reading a file line by line using the Scanner class
    By JavaPF in forum File Input/Output Tutorials
    Replies: 0
    Last Post: April 17th, 2009, 07:34 AM
  4. [SOLVED] Problem in Coin-counter with scanner class
    By coccoster in forum File I/O & Other I/O Streams
    Replies: 6
    Last Post: March 25th, 2009, 08:46 AM
  5. Replies: 1
    Last Post: May 13th, 2008, 08:08 AM