Search:

Type: Posts; User: taze

Search: Search took 0.20 seconds.

  1. Replies
    13
    Views
    1,584

    Re: PrintStream, strings and reading from a file.

    Here is the error message I am getting:

    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind
    ex out of range: -1
    at...
  2. Replies
    13
    Views
    1,584

    Re: PrintStream, strings and reading from a file.

    So I have this:



    import java.util.*;
    import java.io.*;
    public class StoryGenB {
    public static void main(String[] args) {
    file();
    }
  3. Replies
    13
    Views
    1,584

    Re: PrintStream, strings and reading from a file.

    So I fixed that so the current code is this:


    import java.util.*;
    import java.io.*;
    public class StoryGenB {
    public static void main(String[] args) {
    file();
    }
  4. Replies
    13
    Views
    1,584

    Re: PrintStream, strings and reading from a file.

    So I did realize that I wasn't printing anything out to the filewriter, and I renamed it like above so that my code is now this:


    import java.util.*;
    import java.io.*;
    public class StoryGenB {...
  5. Replies
    13
    Views
    1,584

    Re: PrintStream, strings and reading from a file.

    Doesn't f.close() near the end of the code do the flush/closing of the FileWriter? It still only creates a blank document instead of writing the text.
  6. Replies
    13
    Views
    1,584

    Re: PrintStream, strings and reading from a file.

    Unfortunately, FileWriter is not something I've learned and I have any idea how to implement to the above code, likewise the file we have to use to bring the story has to be declared early on (when...
  7. Replies
    13
    Views
    1,584

    PrintStream, strings and reading from a file.

    I've gotten sort of stuck on my assignment for my Java class and I was wondering if anyone could point me in the right direction.

    The general idea of what is intended is that the computer will...
Results 1 to 7 of 7