Search:

Type: Posts; User: loui345

Search: Search took 0.11 seconds.

  1. Re: Help writing to a file getting an exception error

    Can someone close this it's solved.
  2. Re: Help writing to a file getting an exception error

    Even though it is solved, do you think i should still rewrite the code and make it like you suggested? It seems like a lot of extra work, but do you think it will pay dividends in the future?
  3. Re: Help writing to a file getting an exception error

    It worked... I had to many scanners opening and not closing.
  4. Re: Help writing to a file getting an exception error

    Thank you, Thank you, and Thank you.
  5. Re: Help writing to a file getting an exception error

    Yes, the problem is with the readFile() method. All the other code works perfectly. I am unsure on how to read data and store the data into variables. I thought the scanner method could achieve that...
  6. Re: Help writing to a file getting an exception error

    I am sorry, i misunderstood you. My intentions was to read the text file store the information into variables, which then would allow me to manipulate the data. That what I thought you was asking...
  7. Re: Help writing to a file getting an exception error

    Yes, I saved the data to into Strings using the scanner next method, which seems to work.
  8. Re: Help writing to a file getting an exception error

    Okay, great I totally understand your logic, but if i still clean the code up I still don't understand where I went wrong with scanner method. It works as long as the close is in the while loop.
    ...
  9. Re: Help writing to a file getting an exception error

    Yes,

    I understand the point you're trying to make, but if I close the scanner outside of the while loop the program will not write to the text file. I end up with a blank text file. Leaving my...
  10. Re: Help writing to a file getting an exception error

    public class Player {

    private int wonAGame;
    private int lostAGame;
    private int addMoney;
    private static String fPlayer;
    Scanner sn = new Scanner(System.in);

    public...
  11. Re: Help writing to a file getting an exception error

    So it appears, I can continue on with the program logic and continue on with game, keep passing the error to other methods, and each method ducks the error, but inevitability it will throw the...
  12. Re: Help writing to a file getting an exception error

    Yes, that makes perfect sense to close the scanner after the loop is done accessing the variables, but I have tried to close the scanner after the System.out.print and still to no avail. For example,...
  13. Re: Help writing to a file getting an exception error

    I am having trouble closing the scanner
  14. Re: Help writing to a file getting an exception error

    Hello,

    I have gotten my program to work and do what I desire, but I still am getting java.lang.illegalStateException: Scanner closed error. The program is doing what it is suppose to be doing, but...
  15. Re: Help writing to a file getting an exception error

    Now I got the problem to work following newbie's advice. I just would like to know where my thinking went bad, so in the future I won't make this mistake, and possibly I can apply this logic to...
  16. Re: Help writing to a file getting an exception error

    I got it work thanks newbie. SO my problem was that I had many objects of the same class. I should of just created a new object to write to the file?
  17. Re: Help writing to a file getting an exception error

    made a mistake on tags, can someone instruct me again on how to do tags
  18. Help writing to a file getting an exception error

    I have program i am trying to do. I was successful in checking to see if the file was created and if it was not created then creating it. Now I want to actually put data it the file and i am getting...
Results 1 to 18 of 18