Results 1 to 5 of 5

Thread: Text IO class

  1. #1
    stargazerr is offline Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0

    Default Text IO class

    Hi,

    I am new to Java and am trying to use the TextIO class in my code. I have Java6 open sdk running on eclipse 3.4.1 .. However, when I try to use TextIO, I get a "TextIO cannot be resolved" error.

    Can you please help ?? I thought TextIO was built in for every version of Java over Java5 .. Am I doing something wrong ?? Here is some of the sample code I pulled from the internet to try out.

    TextIO.writeUserSelectedFile(); // If user cancels, output automatically
    // goes to standard output.
    TextIO.putln(words.size() + " words found in file:\n");
    TextIO.putln("List of words in alphabetical order"
    + " (with counts in parentheses):\n");
    for ( WordData data : words.values() )
    TextIO.putln(" " + data.word + " (" + data.count + ")");
    TextIO.putln("\n\nList of words by frequency of occurence:\n");
    for ( WordData data : wordsByFrequency )
    TextIO.putln(" " + data.word + " (" + data.count + ")");
    System.out.println("\n\nDone.\n\n");

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    So what is the TextIO class and where did you find this? Was it given to you by your teacher? I ask because it's not part of the standard Java library.

  3. #3
    stargazerr is offline Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0

    Default

    I was trying this one from google. If you google TextIO.java, I picked up the first one the results gave me. But it doesnt seem to work :(

    Basically what I am trying to do is write a program that can give me the 10 most common and the 10 least common words from a text file. I am having major trouble doing this. It would be awesome if you could help. :)

    Thank you.

  4. #4
    stargazerr is offline Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0

    Default

    Okk .. I just read my post again .. I forgot to mention TextIO and TextReader are non-standard classes that I have been instructed to use when writing this program.

    I have googled the two and use them as classes in 2 different packages that I have imported into my program. Even so, my program does not compile and keeps giving me objoct not found, or method not found errors :( ..

    Please HELP !!

    Thanks

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Since they're non-standard, and we don't have an API that we can refer to, we may not be able to help much. For instance, you're using the class's methods as if they are static. Do you know that they in fact are static? If not, have you tried creating an object of the class and calling the methods from the object? If this or other's posts don't help you, you may need to speak with your instructor.

Similar Threads

  1. passing text from a class to a gui class
    By rob in forum AWT / Swing
    Replies: 2
    Last Post: 02-14-2009, 12:04 AM
  2. Class to store Image+Text
    By Gudradain in forum New To Java
    Replies: 2
    Last Post: 11-23-2008, 09:32 AM
  3. Replies: 0
    Last Post: 06-25-2008, 11:34 AM
  4. Replies: 0
    Last Post: 06-25-2008, 11:33 AM
  5. Replies: 5
    Last Post: 08-11-2007, 04:14 AM

Posting Permissions

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